码迷,mamicode.com
首页 >  
搜索关键字:素数筛选    ( 120个结果
ACM-素数筛选
publicclasssushu{ publicstaticvoidmain(String[]args){ inti,m=1000; intcount=0; for(i=1;i<=m;i++){ if(prime(i)){ count++; System.out.print(i+""); if(count%10==0){ System.out.println(); } } } System.out.println();System.out.println("1-100..
分类:其他好文   时间:2014-12-02 15:27:49    阅读次数:156
ZZUOJ-1222- 属于ACMer的游戏 猜素数 (某月赛,总结一下素数筛选法)
题目位置:1222: 属于ACMer的游戏 猜素数 1222: 属于ACMer的游戏 猜素数 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 88  Solved: 21 [Submit][Status][Web Board] Description ACM实验室的众大神们喜欢聚餐大家一起HAPPY 尤其卢学长喜欢请大...
分类:其他好文   时间:2014-12-01 16:04:23    阅读次数:211
素数筛选 HDU 4715
打表,把所有的素数找出来,并且还要把那些数是素数标记下 Difference Between Primes Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2281    Accepted Submission(s): 642 ...
分类:其他好文   时间:2014-11-24 22:34:56    阅读次数:276
HDU-5108-Alexandra and Prime Numbers
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5108这个题目开始想错了,开始我用素数筛选法把1000000内的素数全找出来,大于1000000的数单独判断因为大于1000000得数只有100个,结果也超时,看超时代码#include#include#i...
分类:其他好文   时间:2014-11-23 11:45:16    阅读次数:228
hdu--5108--数论
数据因为很大 达到 max=1e9首先 素数筛选出 sqrt(max)的范围内有多少素数然后 对于每个n 求出它的所有因子 sort一遍后 从小到大开始遍历过去特判下 对于n大于 sqrt(max)的情况下 是否为素数的情况 因为N>1e6的情况不超过100组 所以不会特判很多次的 1 #inclu...
分类:其他好文   时间:2014-11-22 22:56:41    阅读次数:288
POJ 2262 Goldbach's Conjecture(素数相关)
POJ 2262 Goldbach's Conjecture(素数相关) http://poj.org/problem?id=2262 题意: 给你一个[6,1000000]范围内的偶数,要你将它表示成两个素数相加和的形式。如果存在多组解,请输出两个素数差值最大的解。 分析: 首先我们用素数筛选法求出100W以内的所有素数。 筛选法求素数可见: http://blog.csdn.net/u013480600/article/details/411200...
分类:数据库   时间:2014-11-15 11:27:48    阅读次数:254
[ACM] POJ 2689 Prime Distance (大区间素数筛选)
Prime Distance Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12811   Accepted: 3420 Description The branch of mathematics called number theory is about p...
分类:其他好文   时间:2014-11-12 13:51:21    阅读次数:248
Codeforces 484B Maximum Value(高效+二分)
题目链接:Codeforces 484B Maximum Value 题目大意:给定一个序列,找到连个数ai和aj,ai%aj尽量大,并且ai≥aj 解题思路:类似于素数筛选法的方式,每次枚举aj,然后枚举k,每次用二分找到小于k?aj并且最大的ai,维护答案,过程中加了一些剪枝。 #include #include #include using namespace std;...
分类:其他好文   时间:2014-11-07 01:04:41    阅读次数:244
POJ - 2689 Prime Distance(大区间素数筛选)
Description The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the qu...
分类:其他好文   时间:2014-11-05 00:33:10    阅读次数:200
Week SP1:2014/11/2
A:Aizu 0009 Prime Number:素数筛选,注意可能爆内存!!。 #include #include #include #include #include typedef long long LL; using namespace std; #define REPF( i , a , b ) for ( int i = a ; i <= b ; ++ i ) #defin...
分类:其他好文   时间:2014-11-04 15:07:04    阅读次数:254
120条   上一页 1 ... 8 9 10 11 12 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!