Submission #62915
ソースコード
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 | def sieve(n): ret = set() divlis = [-1]*(n+1) # 何で割ったかのリスト(初期値は-1) flag = [True]*(n+1) flag[0] = False flag[1] = False ind = 2 while ind <= n: if flag[ind]: ret.add(ind) ind2 = ind**2 while ind2 <= n: flag[ind2] = False divlis[ind2] = ind ind2 += ind ind += 1 #何で割ったかのリストを取得したいとき, divlisも出力する return ret sievelist = sieve(6000000) n = int (input()) for i in range(n): targ = int (input()) if targ == 1: print( "2" ) elif targ in sievelist: print( "1" ) else : print( "NA" ) |
ステータス
項目 | データ |
---|---|
問題 | 1304 - 掛けても素数!? |
ユーザー名 | shobonvip |
投稿日時 | 2020-08-24 17:04:33 |
言語 | Python3 |
状態 | Time Limit Exceeded |
得点 | 0 |
ソースコード長 | 614 Byte |
最大実行時間 | 1000 ms |
最大メモリ使用量 | 97156 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 3 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | TLE | 1000 ms | 96920 KB |
1
|
in02.txt | TLE | 1000 ms | 96972 KB |
1
|
in03.txt | TLE | 1000 ms | 97016 KB |
1
|
in04.txt | TLE | 1000 ms | 96940 KB |
1
|
in05.txt | TLE | 1000 ms | 96988 KB |
1
|
in06.txt | TLE | 1000 ms | 96912 KB |
1
|
in07.txt | TLE | 1000 ms | 96832 KB |
1
|
in08.txt | TLE | 1000 ms | 96884 KB |
1
|
in09.txt | TLE | 1000 ms | 97060 KB |
1
|
in10.txt | TLE | 1000 ms | 97108 KB |
1
|
in11.txt | TLE | 1000 ms | 96908 KB |
1
|
in12.txt | TLE | 1000 ms | 96832 KB |
1
|
in13.txt | TLE | 1000 ms | 96884 KB |
1
|
in14.txt | TLE | 1000 ms | 96932 KB |
1
|
in15.txt | TLE | 1000 ms | 96980 KB |
1
|
in16.txt | TLE | 1000 ms | 97024 KB |
1
|
in17.txt | TLE | 1000 ms | 97076 KB |
1
|
in18.txt | TLE | 1000 ms | 97000 KB |
1
|
in19.txt | TLE | 1000 ms | 96924 KB |
1
|
in20.txt | TLE | 1000 ms | 96976 KB |
1
|
in21.txt | TLE | 1000 ms | 97156 KB |
1
|
in22.txt | TLE | 1000 ms | 96948 KB |
1
|
in23.txt | TLE | 1000 ms | 97008 KB |
1
|
in24.txt | TLE | 1000 ms | 97060 KB |
1
|
in25.txt | TLE | 1000 ms | 96856 KB |
1
|
in26.txt | TLE | 1000 ms | 96908 KB |
1
|
sample01.txt | TLE | 1000 ms | 96964 KB |
1
|