Submission #6126733


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
int main() {
    vector<int> p;
    vector<bool> p_check(55556,true);
    for(int i = 2; i <= 55555; i++) {
        if(p_check.at(i)) {
            for(int j = i*2; j <= 55555; j += i) p_check.at(j) = false;
        }
    }
    for(int i = 2; i <= 55555; i++) {
        if(p_check.at(i)) p.push_back(i);
    }
    
    int N;
    cin >> N;
    int i = 1, j = 0;
    while(i<=N) {
        if(p.at(j)%5==1) {
            cout << p.at(j);
            if(i==N) cout << endl;
            else cout << " ";
            i++;
        }
        j++;
    }
}

Submission Info

Submission Time
Task D - Five, Five Everywhere
User gyouzasushi
Language C++14 (GCC 5.4.1)
Score 400
Code Size 622 Byte
Status AC
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 5
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 2 ms 256 KB
in02.txt AC 2 ms 256 KB
sample_01.txt AC 2 ms 256 KB
sample_02.txt AC 2 ms 256 KB
sample_03.txt AC 2 ms 256 KB