SGU113 Nearly Prime Numbers
题目大意:
求一个数N是否能由两个质数p1*p2得到(p1可以=p2)
输入:
数据组数Q(1
Q个数,为题目要求的数字N(1
输出:
对于每个数字,如果找得到,则输出"Yes",否则输出"No",用回车隔开。
样例输入:
1
6
样例输出:
Yes
看似比较水的一道题目(实际也比较水)。
首先我们不妨设p...
分类:
其他好文 时间:
2014-11-26 11:33:41
阅读次数:
175
The PrimesIOI'94In the square below, each row, each column and the two diagonals canbe read as a five digit prime number. The rows are read from lef.....
分类:
其他好文 时间:
2014-11-25 23:18:19
阅读次数:
199
题目大意:由1~N的自然数组成一个环,这个环满足相邻的自然数和为素数,
输出所有的情况
思路:本来以为DFS会超时,结果N是小于等于20的,所以直接DFS搜索。DFS
中三个变量,当前数字为now,下一个相邻的数为next,找到N个数中第几个数
为x,如果相邻数相加不是素数,则不必搜下去。否则记录第x个数的结果为next。
如果满足n个数,且最后第N个数与1的和也为素数就输出结果。否则就标记下当前
元素,表示已经使用过,继续找第x+1个数字。最后清除标记。...
分类:
其他好文 时间:
2014-11-24 11:58:00
阅读次数:
217
Alexandra and Prime Numbers
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 706 Accepted Submission(s): 247
Problem Description
...
分类:
其他好文 时间:
2014-11-24 10:12:14
阅读次数:
137
How many prime numbers
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 8205 Accepted Submission(s): 2642
Problem...
分类:
其他好文 时间:
2014-11-24 08:43:47
阅读次数:
116
注意n=n这种情况// 1059.cpp : 定义控制台应用程序的入口点。//#include#include#include#includeusing namespace std;queue prime;vector > col;void printElem(const pair it){ ...
分类:
其他好文 时间:
2014-11-23 18:45:12
阅读次数:
168
Sum of Consecutive Prime Numbers
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 19699
Accepted: 10801
Description
Some positive integers can be represen...
分类:
其他好文 时间:
2014-11-23 16:04:23
阅读次数:
163
Alexandra and Prime Numbers Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionAlexandra has a little ....
分类:
其他好文 时间:
2014-11-23 12:56:30
阅读次数:
268
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5108这个题目开始想错了,开始我用素数筛选法把1000000内的素数全找出来,大于1000000的数单独判断因为大于1000000得数只有100个,结果也超时,看超时代码#include#include#i...
分类:
其他好文 时间:
2014-11-23 11:45:16
阅读次数:
228
Problem Description
Alexandra has a little brother. He is new to programming. One day he is solving the following problem: Given an positive integer N, judge whether N is prime.
The problem above is...
分类:
其他好文 时间:
2014-11-23 09:26:35
阅读次数:
240