码迷,mamicode.com
首页 >  
搜索关键字:calculate prime s    ( 3428个结果
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
UVA - 11481 Arrange the Numbers
Consider this sequence {1, 2, 3, … , N}, as a initial sequence of firstN natural numbers. You can rearrange this sequence in many ways. Therewill be N! different arrangements. You have to calculate t...
分类:其他好文   时间:2014-08-23 15:27:01    阅读次数:202
URAL 1748. The Most Complex Number 反素数
题目来源:URAL 1748. The Most Complex Number 题意:求一个小于等于n的因子最多的数 思路:搜索+剪枝 #include #include using namespace std; typedef unsigned __int64 LL; LL prime[16] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53...
分类:其他好文   时间:2014-08-22 21:12:09    阅读次数:228
Modify PDF operators.
1 Depart Process: 2 1. Grep xref and trailer binary position in file. 3 2. Dump xref table and trailer part. 4 3. Calculate every object binary o...
分类:其他好文   时间:2014-08-22 19:36:19    阅读次数:176
projecteuler---->problem=35----Circular primes
Problem 35 The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13,...
分类:其他好文   时间:2014-08-22 17:52:39    阅读次数:185
sznoi b003
这题坑了我,原因是题目数据问题1000000告诉我100 OTL附代码 1 #include 2 #include 3 #include 4 using namespace std; 5 6 bool prime[1100000] = {0}; 7 8 void getlist(int m...
分类:其他好文   时间:2014-08-22 17:41:29    阅读次数:176
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!