ZOJ2562
来源:互联网 发布:qq会员永久软件 编辑:程序博客网 时间:2024/05/20 10:20
关于反素数的一道题(这里分析的很好http://blog.csdn.net/ACdreamers/article/details/25049767)
首先是反素数的概念:对任意的正整数,都有,那么称为反素数。
性质:1一个反素数的所有质因子必然是从2开始的连续若干个质数
2如果,那么必有
本题的意思:求出中约数个数最多的这个数
#include<iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <cstdio>
//#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
typedef unsigned long long ULL;
const ULLINF = ~0ULL;
int p[16]= {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53};
ULL ans,n;
int best;
void dfs(ULLtmp,int num,int k)//num表当前的约数个数,tmp指当前的数
{
if(k>15)return;
if(num>best){ans=tmp;best=num;}
if(num==best&&tmp<ans)ans=tmp;
for(int i=1;i<=63;i++)
{
if(tmp*p[k]>n)break;
dfs(tmp*=p[k],num*(i+1),k+1);
}
return;
}
int main()
{
while(cin>>n)
{
ans=INF;
best=0;
dfs(1,1,0);
cout<<ans<<endl;
}
return 0;
}
- ZOJ2562
- zoj2562(反素数)
- zoj2562 More Divisors
- zoj2562 反素数
- zoj2562(反素数)
- ZOJ2562 More Divisors
- hdu4542 && ZOJ2562(反素数)
- 反素数的应用 hdu4228 zoj2562
- zoj2562--More Divisors(反素数模板)
- ZOJ2562:More Divisors(反素数)
- zoj2562 More Divisors && CF27E. Number With The Given Amount Of Divisors(反素数)
- Python字符串操作之字符串搜索与替换
- (15.1.13)阅读理解
- [欧拉计划]Problem 1.Multiples of 3 and 5
- 二叉搜索树与双向链表
- TCP三次握手,及其背后的缺陷
- ZOJ2562
- 机器视觉开源代码集合
- HTML与CSS_基础 翁恺 笔记(2015.8.10更新)
- ContentProvider简结
- 学习JavaBean 遇到的问题
- 杭电ACM1394——Minimum Inversion Number
- leetcode 83: Remove Duplicates from Sorted List
- [c]sdnuoj1116 AC自动机
- Python requests库解析中文网页乱码处理方法