数论题目小结 #by nobody
2012-10-06 13:38
316 查看
本小结会不断更新,转载注明出处:http://blog.csdn.net/xdu_truth/article/details/8043051
pku2689 Prime Distance
其实这个题的突破口在于U-L<=1000000,自然想到筛法。先找出sqrt(2^32)内的所有素数,然后类似筛选法筛选掉[l,u]范围内的数
ZOJ 2562 //反素数
题意:找出不大于n因子最多的最小的数。
poj 1811
裸的miller_rabin和pollard模板题,,需要模板可以去看我的
/article/9825886.html
pku2689 Prime Distance
其实这个题的突破口在于U-L<=1000000,自然想到筛法。先找出sqrt(2^32)内的所有素数,然后类似筛选法筛选掉[l,u]范围内的数
ZOJ 2562 //反素数
题意:找出不大于n因子最多的最小的数。
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long LL; LL p[15] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43}; LL ans = 0,ansnum = 0; void back_prime(LL now,int d,LL num,LL n) { if(d>=14)return; if(num>ansnum){ansnum = num;ans = now;} else if(num==ansnum){ans = min(ans,now);} LL temp = 1LL; for(int i=0;i<=53;i++) { temp *= p[d]; if(now*temp > n)break; back_prime(now*temp,d+1,num*((LL)i+2LL),n); } } int main() { LL n; while(cin >> n) { ans = 0,ansnum = 0; back_prime(1LL,0,1LL,n); cout << ans << endl; } return 0; }
poj 1811
裸的miller_rabin和pollard模板题,,需要模板可以去看我的
/article/9825886.html
相关文章推荐
- 数论类题目小结 (转帖)~~~经典…
- 天梯题目解答--通过初赛 3数论-4进制转换
- 后缀数组题目小结。
- 面试中的二叉树题目小结
- 博弈类题目小结(hdu poj zoj)
- 算法小题目小结。。。
- 博弈类题目小结(HDU,POJ,ZOJ)
- 数论某些题目
- UVA 题目1521 GCD Guessing Game(数论+贪心)
- virtual hust 2013.6.20 数论基础题目 D - Just the Facts
- 图论题目建图小结
- pku kmp题目小结
- 简单的数论题目zju1652(不知道有没有AC,因为我在zju上没帐号)PKU上没有
- 数学类题目小结
- 数学类题目小结
- 紫书数论小结
- AC题目简解-数论
- 母函数题目小结
- 博弈类题目小结(HDU,POJ,ZOJ)
- 博弈类题目小结(HDU,POJ,ZOJ)