码迷,mamicode.com
首页 >  
搜索关键字:prime    ( 2475个结果
swift读取字典中最大的数组和数组最大值
letshabiNumbers=["prime":[2,3,5,7,11,13],"Fibonacci":[1,1,2,3,4,8],"Square":[1,4,9,16,25],]varlargest=0varbigerkind=0vartemp=0vartag=1;vari=0;vars=""for(kind,numbers)inshabiNumbers{/*fornumberinnumbers{ifnumber>largest{largest=number}}*/fornumberinnumber..
分类:编程语言   时间:2014-09-01 15:54:43    阅读次数:173
UVA - 11762 Race to 1
Dilu have learned a new thingabout integers, which is - any positive integer greater than 1 can be divided byat least one prime number less than or equal to that number. So, he is nowplaying with this...
分类:其他好文   时间:2014-08-29 22:45:39    阅读次数:366
HDU 1215
由算术基本定理,直接使用公式就好#include #include #include #include using namespace std;const int Maxp=1000;bool isprime[Maxp];int prime[Maxp],nprime;void Doprime(){ ...
分类:其他好文   时间:2014-08-29 10:52:17    阅读次数:179
POJ 1595 素数打表水题
【题意简述】:给出N和C,让我们求出N以内的包括N的素数,然后根据若N以内的素数为奇数个,就将中间2*c-1个素数输出;若为偶数个,就将中间2*c个素数输出。 【分析】:只要题意理解就简单了。 详见代码: // 224K 16Ms #include using namespace std; #define N 2000 bool isprime[N]; int prime[N],nprime...
分类:其他好文   时间:2014-08-28 08:29:39    阅读次数:172
HDU 2098
水,用来熟悉内容#include #include #include #include #include using namespace std;const int Max=10050;bool prime[Max+10];int main(){ memset(prime,true,sizeof(p...
分类:其他好文   时间:2014-08-27 21:50:58    阅读次数:162
NEFU 2
其实就是筛选素数。如,若能被2是质数,则2的倍数全是合数。如此循环。#include #include #include #include #include using namespace std;const int Max=(1<<24);bool prime[Max+10];bool judge...
分类:其他好文   时间:2014-08-27 20:27:38    阅读次数:191
UVA - 1404 Prime k-tuple (素数筛选)
Description {p1,..., pk : p1 < p2 pk} is called a prime k -tuple of distance s if p1, p2,..., pk are consecutive prime numbers and pk - p1 = s . For example, with k = 4 , s = 8 , {11, 13, 1...
分类:其他好文   时间:2014-08-26 17:25:13    阅读次数:217
Hackerrank--Prime Sum
题目链接The problem is quite simple. You're given a number N and a positive integer K. Tell if N can be represented as a sum of K prime numbers (not neces...
分类:其他好文   时间:2014-08-25 13:19:04    阅读次数:270
模板:筛素数法
参考:http://blog.csdn.net/liukehua123/article/details/54828541.开一个大的bool型数组prime[],大小就是n+1就可以了.先把所有的下标为奇数的标为true,下标为偶数的标为false. 2.然后: for( i=3; i 2 3 #....
分类:其他好文   时间:2014-08-24 22:04:03    阅读次数:180
Poj 2739 Sum of Consecutive Prime Numbers
1.Linkhttp://poj.org/problem?id=27392.ContentSum of Consecutive Prime NumbersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 19167Accepted: 1...
分类:其他好文   时间:2014-08-24 20:49:43    阅读次数:186
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!