Prime Path
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 12974
Accepted: 7342
Description
The ministers of the cabinet were quite upset by the message fr...
分类:
其他好文 时间:
2015-05-05 08:57:28
阅读次数:
324
Count PrimesDescription:Count the number of prime numbers less than a non-negative number,nclick to show more hints.References:How Many Primes Are The...
分类:
其他好文 时间:
2015-05-04 21:41:10
阅读次数:
112
这是从刘汝佳的算法竞赛入门经典中看到的题,书中是这么描述的
给出正整数n和m,输出在[m, n]中的无平方因子数。PS(无平方因子数的概念请自行百度)
#include
#include
#include
bool visited[10000005];
int prime[500000];
int main(){
int n, m;
scanf("%d", &n, &m);
int i,...
分类:
其他好文 时间:
2015-05-04 20:16:39
阅读次数:
98
Count the number of prime numbers less than a non-negative number, n
一个合数总是可以分解成若干质数的乘积。所以,如果把质数的倍数全都去掉,剩下的就是质数了。
要查找n以内的质数,首先2是质数,把2的倍数:4,6,8…去掉;此时3没有被去掉,可以认为是质数,再被3的倍数去掉;然后再到5,再到7,一直到sqrt(n)。设一个布尔类型...
分类:
其他好文 时间:
2015-05-04 20:15:50
阅读次数:
121
Description
The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.
— It i...
分类:
其他好文 时间:
2015-05-04 18:17:41
阅读次数:
94
function days_in_month($month, $year) { // calculate number of days in a month return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year...
分类:
Web程序 时间:
2015-05-04 15:16:43
阅读次数:
195
题目:A number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the ...
分类:
其他好文 时间:
2015-05-04 13:35:13
阅读次数:
111
Prime Ring Problem
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 31900 Accepted Submission(s): 14108
Problem Description
A ring is...
分类:
其他好文 时间:
2015-05-04 10:06:07
阅读次数:
163
求100以内的质数
By 白熊花田(http://blog.csdn.net/whiterbear) 转载需注明出处,谢谢。
描述:
输出100以内的所有素数,素数之间以一个空格区分
分析:
首先了解下素数:素数(prime number)又称质数,有无限个。一个大于1的自然数,除了1和它本身外,不能被整除以其他自然数(质数),换句话说就是该数...
分类:
其他好文 时间:
2015-05-03 23:46:14
阅读次数:
319
Description
There are many parallel lines on the ground with the distance of D between each adjacent two. Now, throwing a needle randomly on the ground,please calculate the possibility of that the ...