Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "": {
- "prefix": "cd_sieve",
- "body": [
- "const int N = 2e5 + 10;",
- "vector<bool> isPrime(N, 1);",
- "// vector<int> primes;",
- "",
- "// call sieve() in main",
- "void sieve(){",
- " isPrime[0] = isPrime[1] = 0;",
- "",
- " for(int i = 2; i < N; i++){",
- " if(isPrime[i]){",
- " // primes.push_back(i);",
- "",
- " for(int j = 2 * i; j < N; j += i) {",
- " isPrime[j] = 0;",
- " }",
- " }",
- " }",
- "}"
- ],
- "description": ""
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment