题目来自: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 -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
直接筛素数预处理。
#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;
...
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
题目大意:给定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
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
#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
#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
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
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