AC代码:#include#include#include#includeusingnamespacestd;constintmaxn=1001000;#defineinf(1ans)ans=tmp;tmp=p[s+k-1]-a+1;if(tmp>ans)ans=tmp;for(inti=s;i+k...
分类:
其他好文 时间:
2014-07-27 23:32:49
阅读次数:
227
DescriptionYou've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has e...
分类:
其他好文 时间:
2014-07-27 22:31:39
阅读次数:
809
题目链接: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
题目简单的计算A,B之间有多少个素数只是测试数据有是负的//AC//A和B之间有多少个素数//数据可能有负的!!!#include#include//素数筛选法int pri[100000+10];//1 合数, 0 素数void Prime(){ memset(pri,0,sizeof(pr...
分类:
其他好文 时间:
2014-07-19 20:04:10
阅读次数:
266
Summation of Four Primes
题目链接:click here~
题目要求:
给出一个整数要你将其拆成由四个素数组成的数。如果,不能拆则输出“Impossible.”
思路解析:
根据题目给出的两个猜想,可以得到。如果,一个数是奇数的话则其一定可以拆成一个奇数+一个偶数的形式,而一个数是偶数的话可拆的就有两种奇数+奇数/偶数+偶...
分类:
其他好文 时间:
2014-07-18 12:35:29
阅读次数:
258
Summation of Four Primes
Input: standard input
Output: standard output
Time Limit: 4 seconds
Euler proved in one of his classic theorems that prime numbers are infinite in number. But can every nu...
分类:
其他好文 时间:
2014-07-17 21:05:16
阅读次数:
299
Description
Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes. Work in this area has resulted in the practical use of...
分类:
其他好文 时间:
2014-07-17 10:12:16
阅读次数:
191
题目:输出给定区间中,本身是素数,并且这个数的各位之和也是素数的数(称为位素数)的个数。
分析:数论。首先利用筛法,求出1000000内的所有的素数;然后在利用生成的素数表,
判断每个数是不是各位之和也是素数;再后求出从0开始到任意区间中包含位素数数的个数;
最后输出两个区间之差就是区间中的位素数的个数。
说明:达标法计算,查询输出。
#i...
分类:
其他好文 时间:
2014-07-14 11:17:54
阅读次数:
214
发现其实有关gcd的题目还是挺多的,这里根据做题顺序写出8题。[bzoj2818: Gcd] gcd(x,y)=质数, 1#include const int MAXN = 10000001;int n, primes;long long prime[MAXN], phi[MAXN];bool co...
分类:
其他好文 时间:
2014-06-25 22:12:36
阅读次数:
317
title:
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
翻译:
10以下的质数的和为2 + 3 + 5 + 7 = 17。
请求出200,0000以下所有质数的和。
import math,time
d...
分类:
其他好文 时间:
2014-06-01 09:12:31
阅读次数:
239