Submission #4049319


Source Code Expand

#include<bits/stdc++.h>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<bool> ch(60000);
    fill(ch.begin(), ch.end(), true);
    ch[0] = false;
    ch[1] = false;
    for(int i = 2; i < 60000; i++){
        if(ch[i]){
            for(int k = 2; k * i < 60000; k++) ch[i * k] = false;
        }
    }
    int s = 0, k = 0;
    while(k < n){
        if(ch[s] && 1 == s%5)cout << s <<" ", k++;
        s++;
    }
    cout << endl;
    return 0;
}

Submission Info

Submission Time
Task D - Five, Five Everywhere
User subway
Language C++14 (GCC 5.4.1)
Score 400
Code Size 491 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 1 ms 256 KB
in02.txt AC 1 ms 256 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 2 ms 256 KB
sample_03.txt AC 1 ms 256 KB