Submission #2460703


Source Code Expand

// header {{{
#include <bits/stdc++.h>
using namespace std;

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

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

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    vector<int> p;
    inc(i, 1, 1000){
        if(isPrime(10*i+1)){
            p.push_back(10*i+1);
            //cout << 10*i-1 << endl;
        }
        if(p.size() == 60){
            break;
        }
    }

    int n;cin >> n;
    inc(i, 0, n){
        cout << p[i];
        if(i != n-1){
            cout << " ";
        }
    }
    cout << endl;
    return 0;
}

Submission Info

Submission Time
Task D - Five, Five Everywhere
User monman53
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1230 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