码迷,mamicode.com
首页 >  
搜索关键字:素数筛    ( 359个结果
UVa 884 - Factorial Factors
题目:输出n!中素数因数的个数。分析:数论。这里使用欧拉筛法计算素数,在计算过程中求解就可以。 传统筛法是利用每一个素数,筛掉自己的整数倍; 欧拉筛法是利用当前计算出的全部素数,乘以当前数字筛数; 所以每一个前驱的素椅子个数一定比当前数的素因子个数少一个。说明:重新用了...
分类:其他好文   时间:2015-06-02 12:39:51    阅读次数:114
POJ_3421_X-factor Chains(素数筛法)
X-factor Chains Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5659   Accepted: 1786 Description Given a positive integer X, an X-factor chain of length ...
分类:其他好文   时间:2015-05-29 23:15:25    阅读次数:262
CodeForces 546D Soldier and Number Game
题目链接:click here~~ 【题目大意】 两个整数a, b。求出a, a - 1, a - 2........b + 1这些整数能被拆分成多少个素数相乘,把每个的拆分结果相加起来。例如 a = 6, b = 2. 那么结果=1(3=3) + 2(4=2*2) + 1(5=5) + 2(6=2*3) = 5 【解题思路】:素数筛法,先把每个数能拆分成多少个素数预处理一下,之后用前缀...
分类:其他好文   时间:2015-05-27 12:29:41    阅读次数:186
hdu 2710 Max Factor
#include #include #include using namespace std; const int maxn=20005; int a[maxn]; void isprime()//素数筛 { memset(a,0,sizeof(a)); for(int i=2;i<maxn;i++)//用a[]这个数组存的...
分类:其他好文   时间:2015-05-26 21:26:24    阅读次数:107
Codeforces Round #304 (Div. 2)——D素数筛+dp——Soldier and Number Game
Two soldiers are playing a game. At the beginning first of them chooses a positive integernand gives it to the second soldier. Then the second one tri...
分类:其他好文   时间:2015-05-26 21:06:35    阅读次数:198
POJ题目2689 Prime Distance(任何区间素数筛选)
Prime Distance Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13459   Accepted: 3578 Description The branch of mathematics called number theory is about prope...
分类:其他好文   时间:2015-05-23 11:31:57    阅读次数:127
区间素数筛法
给定整数a和b,请问区间[a,b)内有多少个素数?a 2 #include 3 #include 4 using namespace std; 5 typedef long long ll; 6 const int maxn = 1000005; 7 bool is_prime[maxn]; 8.....
分类:其他好文   时间:2015-05-19 22:28:23    阅读次数:203
AOJ - 0009 Prime Number (素数筛法) && AOJ - 0005 (求最大公约数和最小公倍数)
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=34870求n内的素数个数。 1 /* *********************************************** 2 Author : zch ...
分类:其他好文   时间:2015-05-19 18:17:50    阅读次数:292
POJ 2689 Prime Distance(素数筛选)
题目链接:http://poj.org/problem?id=2689题意:给出一个区间[L, R],找出区间内相连的,距离最近和距离最远的两个素数对。其中(1 2 #include 3 typedef long long LL; 4 const int MAXN = 50000; 5 const....
分类:其他好文   时间:2015-05-14 13:50:40    阅读次数:126
Eratosthenes,筛法求素数
//筛法求区间[0,n]的所有素数,v为素数表 //v[i]==0,i为素数void f(int n) { int m=sqrt(n+0.5); memset(v,0,sizeof(v)); for (int i=2;i<=m;i++) if (!v[i]) for ...
分类:其他好文   时间:2015-05-10 11:19:57    阅读次数:115
359条   上一页 1 ... 24 25 26 27 28 ... 36 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!