Submission #3418740


Source Code Expand

#include <bits/stdc++.h>
#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

#define FOR(i,n) for(ll i=0;i<n;i++)

struct edge{ll to,cost;};

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0); 
   int N;
   cin >> N;
   vector<bool> Num(55556,true);
   Num[0] = Num[1] = 0;
   for(int i=2;i<=N;i++){
      if(Num[i]){
         for(int j=i+1;j<=55555;j++){
            if(j%i==0)Num[j]=false;
         }
      }
   }
   ll ans=0;
   for(int i=0;i<=55555;i++){
      if(Num[i]&&i%5==1){
         cout << i << " ";
         ans++;
      }
      if(ans == N){
         cout << endl;
         break;
      }
   }
   return 0;
}

Submission Info

Submission Time
Task D - Five, Five Everywhere
User reg7777
Language C++14 (GCC 5.4.1)
Score 0
Code Size 769 Byte
Status WA
Exec Time 4 ms
Memory 256 KB

Judge Result

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