hdu 2710 Max Factor

PX4 Offboard模式实战避坑:为什么你的Gazebo无人机解锁了却飞不起来? 本文深入解析PX4 Offboard模式下Gazebo无人机解锁后无法起飞的关键原因,提供详细的故障排查流程和调试方法。重点解决MAVROS连接、setpoint消息频率、坐标系一致性等常见问题,帮助开发者快速掌握无人机控制核心技术。 阅读详情
Problem Description
To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortunately, he is unaware that the cows interpret some serial numbers as better than others. In particular, a cow whose serial number has the highest prime factor enjoys the highest social standing among all the other cows.

(Recall that a prime number is just a number that has no divisors except for 1 and itself. The number 7 is prime while the number 6, being divisible by 2 and 3, is not).

Given a set of N (1 <= N <= 5,000) serial numbers in the range 1..20,000, determine the one that has the largest prime factor.
 

Input
* Line 1: A single integer, N

* Lines 2..N+1: The serial numbers to be tested, one per line
 

Output
* Line 1: The integer with the largest prime factor. If there are more than one, output the one that appears earliest in the input file.
 

Sample Input
436384042
 

Sample Output
38
 

Source


题意:

求给出数据含有最大质数的数,然后输出包含最大质数的数,如果有多个,要输出最前面的那个数。

//以前用素筛只是简单的拿来快速判断一个数是不是素数,没想到还可以这样用,通过素筛,把每一个数的最大质数找出来

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int a[20050];

int main()
{
    memset(a,0,sizeof(a));
    a[1]=1;
    for(int i=2; i<20010; i++)
    {
        if(a[i]==0)
        {
            for(int j=i; j<20010; j+=i)
                a[j]=i;
        }
    }
    int n,x,mx=-1,res;
    while(cin>>n)
    {
    mx=-1;
        for(int i=0; i<n; i++)
        {
            scanf("%d",&x);
            if(a[x]>mx)
            {
                mx=a[x];
                res=x;
            }
        }
        cout<<res<<endl;
    }
    return 0;
}

Devexpress16.2.6破解工具 Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具 立即下载

相关推荐

数电发票“乐企直连”服务平台建设方案

数字化电子发票“乐企直连”服务平台建设方案

m0_73174802的博客 4852

HDU 2709 Max Factor (素数因子)

Max Factor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8635    Accepted Submission(s): 2817 Problem Description To improve the

Sizaif's 小屋 468

(南京观海微电子)——TCON介绍

TCON又称:逻辑板,控制板,在液晶电视里的作用和CRT中的视放板相当,但有本质的区别,逻辑板不是一个纯粹的信号放大器,它输入是LVDS格式信号,而不是RGB。逻辑板的作用是把数字板送来的LVDS或TTL图像数据信号,时钟信号进行处理移位寄存器存储将图像数据信号,时钟信号转换成屏能够识别的控制信号行列信号RSDS控制屏内的MOSFET管工作而控制液晶分子的扭曲度。目前国内主要的TCON板生产商有视显光电。传统TCON的布局主要分为以下两种:X+C分离式和X+C一体式。

m0_75095200的博客 3834

HDU-2710 Max Factor(最大质因子)

  Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 11601    Accepted Submission(s): 3673 Problem Description To improve the organization of h...

LOVE&AI的博客 905

卷积操作复杂度公式推导

复杂度Hout⋅Wout⋅Cout⋅Cin⋅k2\text{复杂度} = H_{\text{out}} \cdot W_{\text{out}} \cdot C_{\text{out}} \cdot C_{\text{in}} \cdot k^2复杂度Hout​⋅Wout​⋅Cout​⋅Cin​⋅k2该公式反映了卷积核作用于每个像素时的局部操作和跨通道的计算需求。卷积计算复杂度与输入尺寸线性相关。

qq_41037856的博客 1306

datart 二开环境搭建

下载源码, 地址: https://github.com/running-elephant/datart, dev 分支; 解压后使用 idea 打开; 服务端: 3.1 安装依赖, idea会自动安装; 3.2 修改配置文件 /config/application.yml 3.3 创建数据库,并将bin/datart.sql导入到数据库中 3.4 入口: /server/src/main/java/datart/DatartServerApplication.java [外链图片转存失败,源站可能有防.

又是再见? 6132

HDU 2710 Max Factor (筛选求素数)

Max Factor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3995    Accepted Submission(s): 1301 Problem Description To improve the

芝兰生于深谷,不以无人而不芳 1053

ArcGIS:根据DEM数据提取区域水系

利用DEM数据提取区域水系是常见的水文分析应用,为了获取区域的矢量水系数据,我们可以通过ArcGIS对高程DEM数据进行水文分析,为地表水流建立模型,进而获取到该地的水系数据,DEM数据精度越高,获取到的水系数据精度也就越高。以下介绍如何用ArcGIS提供的工具提取水系。

Oruizn的博客 9108

素数筛选法2

Max Factor Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4782 Accepted: 1865 Description To i

875

计算机视觉之ResNet

RestNet是2015年由微软团队提出的,在当时获得分类任务,目标检测,图像分割第一名。该论文的四位作者何恺明、张祥雨、任少卿和孙剑如今在人工智能领域里都是响当当的名字,当时他们都是微软亚研的一员。实验结果显示,残差网络更容易优化,并且加深网络层数有助于提高正确率。在ImageNet上使用152层的残差网络(VGG net的8倍深度,但残差网络复杂度更低)。对这些网络使用集成方法实现了3.75%的错误率。获得了ILSVRC 2015竞赛的第一名。原文链接这是一篇计算机视觉领域的经典论文。

十年以上架构设计经验,专注于软件架构和人工智能领域,对机器视觉、NLP、音视频等领域都有涉猎 2万+

Kotlin kapt插件报错全解析:从Could not load module到彻底解决(含Gradle 8.2.2适配指南)

本文深度解析了Kotlin开发中常见的kapt插件报错“Could not load module”的根源,并提供了从诊断到解决的完整方案。重点探讨了Gradle 8.2.2与Kotlin 1.9.x的兼容性问题,包括JVM IR后端冲突、配置缓存问题及依赖版本对齐,并给出了详细的调试技巧与迁移至KSP的建议。

rrr55的博客 315

HDU2710 Max Factor【水题】【素因子】

题目大意:给你N个数,找出这N个数拥有最大素因子的那个数。 思路:筛法求素数的方法求出所有20000范围内所有数最大的素因子,然后遍历N个数, 找出最大的即可。

程序员充电站(itcharge) 3137

基于STM32L4XX、HAL库的ESP32-C3-WROOM-02-N4 WIFI模块驱动程序设计

支持802.11 b/g/n Wi-Fi (2.4GHz)RISC-V 32位单核处理器,主频高达160MHz。封装尺寸:18mm × 20mm × 3mm。工作温度范围:-40°C ~ 85°C。// 设置WiFi模式为STA。支持Bluetooth 5 (LE)// 发送AT指令测试通信。// 检查响应是否包含OK。内置4MB SPI Flash。// 连接TCP服务器。// 发送HTTP请求。// 初始化UART。// 建立TCP连接。低功耗设计,适合IoT应用。

zhusl6688的博客 384

HDU-2710 Max Factor

HDU 2710 Max Factor To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortunately, he is unaware that...

你呢的博客 1069

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

HDU 2710 Max Factor(素数筛选)

题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=2710 题目大意:给出几个数,找出最大的素数因子,如果素数因子相同,则输出最小的那个数。 思路:以前求素数都是用两层循环,现在这个数字比较大,还是用老方法会超时,所以很容易想到素数筛选(以前就做过一道素数筛选的题目,嘿嘿),题目唯一不同的就是在题目里面1是作为素数的(还是从网上找到的)。 代码:

A_Eagle的专栏 2651

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

hdu 2710 Max Factor 筛法

hdu 2710 Max Factor 筛法 To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortunately, he is unaware that the cows interpret some serial numbers as better

klc的博客 403

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

HDU 2710 Max Factor

链接:http://acm.hdu.edu.cn/showproblem.php?pid=2710   这道题有点问题,,,是多组数据,

M阳光的专栏 1884

hdu 2710【Max Factor】

Problem Description To improve the organization of his farm, Farmer John labels each of his N (1 &lt;= N &lt;= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortunately, ...

resurrectioncancel的博客 186

HDU 2710.Max Factor

题目:http://acm.hdu.edu.cn/showproblem.php?pid=2710 AC代码(C++): #include #include #include #include #include #include #include #define INF 0x3f3f3f3f #define eps 1e-8 typedef unsigned lon

njyexiong的博客 261

[HDU - 2710] Max Factor

Problem Description To improve the organization of his farm, Farmer John labels each of his N (1 &lt;= N &lt;= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortunately, he is u...

Chanx 's Blog 261

Max Factor hdu2710

Problem Description To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortunately, he is unawa

chaoyueziji123的专栏 706

HDU2710 Max Factor

Description To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortunately, he is unaware that

xu_fish的博客 653

Max Factor hdu2710 素数相关

http://acm.hdu.edu.cn/showproblem.php?pid=2710 按最大质因数排序,输出含有最大质因数的数。 比较简单的问题啦。 =w= #include #include #include using namespace std; #define N 20005 int factor[N]; void init(){ int k=floor(sqrt(

operator456的专栏 513

hdu 2710 Max Factor

hdu 2710 Max FactorProblem Description To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortu

HJ 591

hdu2710Max Factor(水题)

Max Factor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 6283    Accepted Submission(s): 2056 Problem Description To improve the orga

Snow丶的博客 597
上一篇: CodeForces 740A - Alyona and copybooks
下一篇: 统计硬币 hdu-2566
stanley610
博客等级 码龄9年 24粉丝 76原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值