码迷,mamicode.com
首页 >  
搜索关键字:primes    ( 339个结果
Count Primes Total Accepted: 831 Total Submissions: 6167
题目来自:Leetcode https://leetcode.com/problems/count-primes/ Count Primes  Total Accepted: 831 Total Submissions: 6167My Submissions Question  Solution  Description: ...
分类:其他好文   时间:2015-04-27 23:50:05    阅读次数:174
leetcode - Count Primes
leetcode -https://leetcode.com/problems/count-primes/Q:Description:Count the number of prime numbers less than a non-negative number,nHint:The number ...
分类:其他好文   时间:2015-04-27 18:10:59    阅读次数:230
2 UVA 10394 Twin Primes
直接筛素数预处理。 #include #include #include using namespace std; const int maxn=20000000; bool pri[20000005]; vector v; void init() { int i,j; memset(pri,1,sizeof pri); pri[0]=pri[1]=0; ...
分类:Windows程序   时间:2015-04-26 22:56:15    阅读次数:227
POJ 3132 Sum of Different Primes ( 满背包问题)
Sum of Different PrimesTime Limit:5000MSMemory Limit:65536KTotal Submissions:3280Accepted:2040DescriptionA positive integer may be expressed as a sum ...
分类:其他好文   时间:2015-04-22 01:46:36    阅读次数:169
* SPOJ PGCD Primes in GCD Table (需要自己推线性筛函数,好题)
题目大意:给定n,m,求有多少组(a,b) 0g(p'x)=mu[x]2.x%p'!=0 , 那么对于先前所有的 x/p 来说,此时乘了p' , 若p!=p' , 那么因为多了一个因子 mu[p'*x/p] = -mu[x/p] , 所以在p!=p'时,所有的情况相加为-g(x),在考虑枚举到的p'...
分类:其他好文   时间:2015-04-14 23:13:17    阅读次数:231
Sicily 14256. Pseudo Semiprime
14256. Pseudo Semiprime Constraints Time Limit: 1 secs, Memory Limit: 256 MB Description In number theory, a positive integer is a semiprime if it is the product of two primes. For example, 35 i...
分类:其他好文   时间:2015-04-08 09:13:44    阅读次数:108
uva 11762
#include #include #include #include using namespace std; #define MAX 1000010 #define MAXP 700000 int vis[MAX]; int prime[MAXP]; int n; double dp[MAX]; bool flag[MAX]; int primes_num; void sieve...
分类:其他好文   时间:2015-03-21 20:05:32    阅读次数:134
10375 - Choose and divide
#include using namespace std; const int maxn = 10000 + 5; int e[maxn],vis[maxn]; vector primes; void add_primes() { memset(vis,0,sizeof(vis)); int m = sqrt(10000+0.5); for(int i=2;i<=m;i++...
分类:其他好文   时间:2015-03-19 18:30:44    阅读次数:164
hdu 2161 Primes 筛法求素数 大水题
Problem Description Write a program to read in a list of integers and determine whether or not each number is prime. A number, n, is prime if its only divisors are 1 and n. For this problem, the numbers 1 and 2 are not considered primes. Input Each inp...
分类:其他好文   时间:2015-03-13 14:24:56    阅读次数:130
求给定数目的前 n 个素数
bool is_prime (const vector& primes, int num){ for (const auto& prime : primes) { if (num % prime == 0) { return false; } ...
分类:其他好文   时间:2015-03-10 13:26:31    阅读次数:103
339条   上一页 1 ... 27 28 29 30 31 ... 34 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!