博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 2136 Largest prime factor
阅读量:3903 次
发布时间:2019-05-23

本文共 702 字,大约阅读时间需要 2 分钟。

Problem Description

Everybody knows any number can be combined by the prime number.

Now, your task is telling me what position of the largest prime factor.
The position of prime 2 is 1, prime 3 is 2, and prime 5 is 3, etc.
Specially, LPF(1) = 0.

 

 

Input

Each line will contain one integer n(0 < n < 1000000).

 

 

Output

Output the LPF(n).

 

 

Sample Input

 

1

2

3

4

5

 

 

Sample Output

 

0

1

2

1

3

通过素数筛的过程中来求得最大素数因子。。。

代码如下:

#include 
#include
#include
#include
#include
#include
using namespace std;const int maxn=1000010;int Isn[maxn];int n;vector
ve;int loc[maxn];void init(){ memset (Isn,0,sizeof(Isn));}void Is_prime(){ loc[1]=0; for (int i=2,k=1;i

 

转载地址:http://lxaen.baihongyu.com/

你可能感兴趣的文章
面向对象设计案例——点和圆关系
查看>>
深拷贝与浅拷贝
查看>>
WinForm 打开txt文件
查看>>
WinForm 实现日志记录功能
查看>>
WinForm 读取照片文件
查看>>
WinForm ComboBox不可编辑与不可选择
查看>>
WinForm textbox控件设置为不可编辑
查看>>
winForm ImageList图像控件使用
查看>>
WinForm TabControl标签背景色
查看>>
Winform TabControl标签美化
查看>>
打印日志类
查看>>
WinForm 获取文件/文件夹对话框
查看>>
PyCharm打包.exe遇到的问题
查看>>
winform中添加Windows Media Player
查看>>
345. 反转字符串中的元音字母
查看>>
67. 二进制求和
查看>>
125. 验证回文串
查看>>
168. Excel表列名称
查看>>
400. 第N个数字
查看>>
209. 长度最小的子数组
查看>>