結果
問題 | No.7 プライムナンバーゲーム |
ユーザー |
![]() |
提出日時 | 2022-02-17 10:56:25 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 987 ms / 5,000 ms |
コード長 | 486 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-10-01 16:46:39 |
合計ジャッジ時間 | 7,563 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
N = int(input())prime = [ True ] * (N + 1)prime[0], prime[1] = False, Falsefor i in range(2, N + 1):if prime[i]:for j in range(i * 2, N + 1, i):prime[j] = Falseplist = list(filter(lambda x: prime[x], range(2, N + 1)))wins = [ False ] * (N + 1)wins[0], wins[1] = True, Truefor i in range(2, N + 1):pos = 0while pos < len(plist) and plist[pos] <= i:if not wins[i - plist[pos]]:wins[i] = Truebreakpos += 1if wins[N]:print("Win")else:print("Lose")