Submission #2460245


Source Code Expand

//Daniel Grzegorzewski
#include <bits/stdc++.h>

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

bool prime(int x)
{
  if (x < 2)
    return false;
  for (int i = 2; i*i <= x; ++i)
    if (x%i == 0)
      return false;
  return true;
}

int n;
VI v;

int main() {
  init_ios();
  cin >> n;
  for (int i = 2; v.size() < n; ++i)
    if (prime(i) && (i%5) == 1)
      v.PB(i);
  for (int x: v)
    cout<<x<<" ";
  cout<<"\n";
}

Submission Info

Submission Time
Task D - Five, Five Everywhere
User Vax
Language C++14 (GCC 5.4.1)
Score 400
Code Size 691 Byte
Status AC
Exec Time 1 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 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB