//相邻的 2.3......d 之和都要不为素数
# include
# include
using namespace std;
int num[1010],vis[1010];
int n,m,d,cot;
int flag[10010];
void init()//素数打表
{
int i,j;
for(i=2;i<10010;i++)
{
if(!flag[i])
f...
分类:
其他好文 时间:
2014-07-24 11:32:42
阅读次数:
234
http://poj.org/problem?id=2689
题意:给出一个大区间[L,U],分别求出该区间内连续的相差最小和相差最大的素数对。
因为L2147483647,直接筛素数是不行的,数组就开不了。但是可以根据素数筛的原理。我们先筛出sqrt(2147483647)以内的素数,然后拿这些素数去筛[L,U]之间的素数,即两次素数筛。但是L,U还是很大,但U-L
#includ...
分类:
其他好文 时间:
2014-07-24 10:28:16
阅读次数:
210
总时间限制:1000ms内存限制:65536kB描述Calculate a + b输入Two integer a,,b (0 ≤ a,b ≤ 10)输出Output a + b样例输入1 2样例输出3提示Q: Where are the input and the output?A: Your pr...
分类:
其他好文 时间:
2014-07-24 10:07:23
阅读次数:
287
题目链接:http://poj.org/problem?id=3292
题目大意:就是给你一个模4余1的数H-number,如果一个H-number是H-primes 当且仅当它的因子只有1和它本身(除1外)。一个H-number是H-semi-prime当且仅当它只由两个H-primes的乘积表示。H-number剩下其他的数均为H-composite。给你一个数h,问1到h有多少个H-sem...
分类:
其他好文 时间:
2014-07-23 22:38:17
阅读次数:
302
Administration of the labyrinth has decided to start a new season with new wallpapers. For this purpose they need a program to calculate the surface area of the walls inside the labyrinth. This job
...
分类:
其他好文 时间:
2014-07-23 22:32:07
阅读次数:
292
from http://www.codeproject.com/Articles/300785/Calculating-simple-running-totals-in-SQL-ServerIntroductionOne typical question is, how to calculate r...
分类:
数据库 时间:
2014-07-23 20:38:05
阅读次数:
374
# include
# include
# include
using namespace std;
int vis[25];
int num[25];
int n,cot;
int prime(int sum)
{
int i;
if(sum==2)
return false;
for(i=2;i*i<=sum;i++)
{
if(...
分类:
其他好文 时间:
2014-07-23 17:07:31
阅读次数:
166
另类打表:将从1到n的满足美素数条件的数目赋值给prime[n],这样最后只需要用prime[L]减去prime[R-1]即可;
美素数
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 2332 Accepted Submis...
分类:
其他好文 时间:
2014-07-23 16:39:02
阅读次数:
157
http://poj.org/problem?id=2034
大致题意:给出区间[n,m],对这个区间的数进行排列使得相邻的2个、3个......d个数之和都不是素数。输出字典序最小的。
思路:裸的dfs。TLE了无数次是因为素数打表的范围太小,最大应打到10000。
#include
#include
#include
#include
#include
...
分类:
其他好文 时间:
2014-07-23 13:37:58
阅读次数:
187
An embodiment may be an apparatus comprising a link coupled with a memory, and circuitry coupled with the link to calculate the amount of memory acces...
分类:
其他好文 时间:
2014-07-23 11:58:56
阅读次数:
397