Submission #2460670
Source Code Expand
#include "iostream" #include "climits" #include "list" #include "queue" #include "stack" #include "set" #include "functional" #include "algorithm" #include "string" #include "map" #include "unordered_map" #include "unordered_set" #include "iomanip" #include "cmath" #include "random" #include "bitset" #include "cstdio" using namespace std; const long long int MOD = 1000000007; long long int N, M, K, H, W, L, R; list<int> Prime(int num) { list<int>P; for (int i = 5; i <= num; i += 6) { bool flag = true; for (auto j : P) { if (j*j > i) { break; } if (i%j == 0) { flag = false; break; } } if (flag)P.push_back(i); flag = true; for (auto j : P) { if (j*j > i + 2) { break; } if ((i + 2) % j == 0) { flag = false; break; } } if (flag)P.push_back(i + 2); } P.push_front(3); P.push_front(2); return P; } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> N; auto box = Prime(55555); for (auto i : box) { if (i % 5 == 1) { cout << i << " "; N--; if (!N) { return 0; } } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Five, Five Everywhere |
User | olphe |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1168 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 384 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | in01.txt, in02.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in01.txt | AC | 3 ms | 384 KB |
in02.txt | AC | 3 ms | 384 KB |
sample_01.txt | AC | 3 ms | 384 KB |
sample_02.txt | AC | 3 ms | 384 KB |
sample_03.txt | AC | 3 ms | 384 KB |