結果
問題 | No.7 プライムナンバーゲーム |
ユーザー | Maboy |
提出日時 | 2017-04-19 23:45:18 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 1,438 ms / 5,000 ms |
コード長 | 391 bytes |
コンパイル時間 | 203 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-04-09 04:14:20 |
合計ジャッジ時間 | 10,325 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
10,880 KB |
testcase_01 | AC | 28 ms
10,752 KB |
testcase_02 | AC | 1,279 ms
11,392 KB |
testcase_03 | AC | 108 ms
11,008 KB |
testcase_04 | AC | 51 ms
10,752 KB |
testcase_05 | AC | 48 ms
10,752 KB |
testcase_06 | AC | 378 ms
11,136 KB |
testcase_07 | AC | 264 ms
10,880 KB |
testcase_08 | AC | 137 ms
11,008 KB |
testcase_09 | AC | 551 ms
11,136 KB |
testcase_10 | AC | 30 ms
10,880 KB |
testcase_11 | AC | 262 ms
10,880 KB |
testcase_12 | AC | 902 ms
11,136 KB |
testcase_13 | AC | 941 ms
11,264 KB |
testcase_14 | AC | 1,309 ms
11,392 KB |
testcase_15 | AC | 1,438 ms
11,136 KB |
testcase_16 | AC | 1,140 ms
11,136 KB |
ソースコード
def PrimeNnm(n): i=1 L=[i for i in range(n+1)] while i < n**0.5: i+=1 if i in L: L=[x if x%i!=0 else 0 for x in L] L[i]=i L=set(L) L.remove(0) L=list(L) L.sort() return L N=int(input()) A=PrimeNnm(N) L=[0]*(N+1) L[0]=1 L[1]=1 for i in range(2,N+1): for j in A: if j>i:break if L[i-j]==0 and j>1: L[i]=1 print("Win" if L[N]!=0 else "Lose")