Submission #00101
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include <bits/stdc++.h> using namespace std; #define int long long template < class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template < class T> bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } bool memo[6000010]; signed main(){ ios::sync_with_stdio( false ); cin.tie(0); int n; cin >> n; for ( int i = 2;i <= 6000000;i++){ if (!memo[i]){ for ( int j = i*2;j <= 6000000;j+=i){ memo[j] = true ; } } } int a; while (n--){ cin >> a; if (a == 1){ cout << 2 << endl; } else if (!memo[a]){ cout << 1 << endl; } else { cout << "NA" << endl; } } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0005 - 掛けても素数!? |
ユーザー名 | ei1719 |
投稿日時 | 2020-04-25 22:22:55 |
言語 | C++14 |
状態 | Time Limit Exceeded |
得点 | 0 |
ソースコード長 | 674 Byte |
最大実行時間 | 1000 ms |
最大メモリ使用量 | 28848 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 300 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 91 ms | 6364 KB |
1
|
in02.txt | AC | 70 ms | 6344 KB |
1
|
in03.txt | AC | 49 ms | 6452 KB |
1
|
in04.txt | AC | 57 ms | 6428 KB |
1
|
in05.txt | AC | 48 ms | 6532 KB |
1
|
in06.txt | AC | 400 ms | 6904 KB |
1
|
in07.txt | TLE | 1000 ms | 8420 KB |
1
|
in08.txt | TLE | 1000 ms | 9940 KB |
1
|
in09.txt | TLE | 1000 ms | 11328 KB |
1
|
in10.txt | TLE | 1000 ms | 12976 KB |
1
|
in11.txt | TLE | 1000 ms | 14496 KB |
1
|
in12.txt | TLE | 1000 ms | 16012 KB |
1
|
in13.txt | TLE | 1000 ms | 17404 KB |
1
|
in14.txt | TLE | 1000 ms | 18792 KB |
1
|
in15.txt | TLE | 1000 ms | 20184 KB |
1
|
in16.txt | AC | 793 ms | 21064 KB |
1
|
in17.txt | TLE | 1000 ms | 21944 KB |
1
|
in18.txt | TLE | 1000 ms | 22948 KB |
1
|
in19.txt | TLE | 1000 ms | 23952 KB |
1
|
in20.txt | TLE | 1000 ms | 25600 KB |
1
|
in21.txt | TLE | 1000 ms | 26728 KB |
1
|
in22.txt | TLE | 1000 ms | 27736 KB |
1
|
in23.txt | TLE | 1000 ms | 28744 KB |
1
|
in24.txt | AC | 57 ms | 28848 KB |
1
|
in25.txt | AC | 57 ms | 28828 KB |
1
|
in26.txt | AC | 47 ms | 28684 KB |
1
|
sample01.txt | AC | 44 ms | 28672 KB |
1
|