結果
問題 | No.7 プライムナンバーゲーム |
ユーザー | kwnwsdnc |
提出日時 | 2018-03-30 23:51:10 |
言語 | Python3 (3.11.6 + numpy 1.26.0 + scipy 1.11.3) |
結果 |
AC
|
実行時間 | 985 ms / 5,000 ms |
コード長 | 742 bytes |
コンパイル時間 | 81 ms |
コンパイル使用メモリ | 10,928 KB |
実行使用メモリ | 259,492 KB |
最終ジャッジ日時 | 2023-07-24 21:06:35 |
合計ジャッジ時間 | 7,590 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
7,828 KB |
testcase_01 | AC | 40 ms
7,832 KB |
testcase_02 | AC | 985 ms
259,492 KB |
testcase_03 | AC | 104 ms
22,128 KB |
testcase_04 | AC | 51 ms
11,116 KB |
testcase_05 | AC | 55 ms
10,868 KB |
testcase_06 | AC | 296 ms
78,580 KB |
testcase_07 | AC | 207 ms
54,592 KB |
testcase_08 | AC | 117 ms
27,816 KB |
testcase_09 | AC | 429 ms
116,896 KB |
testcase_10 | AC | 40 ms
7,856 KB |
testcase_11 | AC | 205 ms
55,148 KB |
testcase_12 | AC | 654 ms
186,864 KB |
testcase_13 | AC | 699 ms
198,568 KB |
testcase_14 | AC | 925 ms
258,660 KB |
testcase_15 | AC | 872 ms
245,924 KB |
testcase_16 | AC | 807 ms
227,208 KB |
ソースコード
prime=[] for i in range(2,10000): judge=0 for j in range(2,100): if i==j: break if i%j==0 : judge+=1 break if judge==0: prime.append(i) def minus(n): Q=[[] for i in range(n+10)] judge=[1 for i in range(n+10)] judge[2]=-1 judge[3]=-1 for i in range(2,n+1): count=0 for p in prime: if i-p<=1: break else: Q[i].append(i-p) for q in Q[i]: if judge[q]==-1: count+=1 if count==0: judge[i]=-1 if judge[n]==-1: return "Lose" else: return "Win" N=int(input()) print(minus(N))