Submission #00098


ソースコード

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
#include <bits/stdc++.h>
using namespace std;
int n , a , c_moon[6000005] = {};
signed main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cin >> n;
for(int i=3 ;i*i <=6000000 ;i+=2){
if(c_moon[i] == 0){
for(int j=i+i ;j<=6000000 ;j+=i) {
c_moon[j] = 1;
}
}
}
for(int i=0 ;i<n ;i++){
cin >> a;
if(a == 1){
cout << "2\n";
} else if(a == 2){
cout << "1\n";
} else if(c_moon[a] == 1 || a%2 == 0){
cout << "NA\n";
} else {
cout << "1\n";
}
}
return(0);
}

ステータス

項目 データ
問題 0005 - 掛けても素数!?
ユーザー名 ei1929
投稿日時 2020-04-25 22:19:49
言語 C++17
状態 Accepted
得点 300
ソースコード長 697 Byte
最大実行時間 208 ms
最大メモリ使用量 64744 KB

セット

セット 得点 Cases
1 ALL 300 / 300 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 64 ms 24028 KB
1
in02.txt AC 64 ms 23836 KB
1
in03.txt AC 65 ms 23900 KB
1
in04.txt AC 70 ms 23964 KB
1
in05.txt AC 85 ms 24024 KB
1
in06.txt AC 100 ms 24480 KB
1
in07.txt AC 193 ms 27236 KB
1
in08.txt AC 177 ms 29604 KB
1
in09.txt AC 166 ms 31972 KB
1
in10.txt AC 192 ms 34856 KB
1
in11.txt AC 193 ms 37736 KB
1
in12.txt AC 202 ms 40616 KB
1
in13.txt AC 190 ms 43496 KB
1
in14.txt AC 208 ms 46372 KB
1
in15.txt AC 206 ms 49248 KB
1
in16.txt AC 112 ms 49948 KB
1
in17.txt AC 153 ms 51932 KB
1
in18.txt AC 179 ms 53916 KB
1
in19.txt AC 147 ms 55896 KB
1
in20.txt AC 127 ms 58780 KB
1
in21.txt AC 126 ms 60764 KB
1
in22.txt AC 135 ms 62616 KB
1
in23.txt AC 145 ms 64596 KB
1
in24.txt AC 70 ms 64660 KB
1
in25.txt AC 77 ms 64732 KB
1
in26.txt AC 74 ms 64672 KB
1
sample01.txt AC 66 ms 64744 KB
1