結果
問題 |
No.7 プライムナンバーゲーム
|
ユーザー |
|
提出日時 | 2023-11-22 12:59:40 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 342 bytes |
コンパイル時間 | 177 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 63,232 KB |
最終ジャッジ日時 | 2024-09-26 07:29:09 |
合計ジャッジ時間 | 1,842 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 7 |
ソースコード
N = int(input()) primes = set(range(2, N+1)) for i in range(2, N+1): if i not in primes: continue for j in range(2*i, N+1): primes.discard(j) primes = sorted(primes) dp = ["Win"]*2 + ["Lose"]*(N-1) for i in range(2, N+1): for d in primes: if i < d: break if dp[i-d] == "Lose": dp[i] = "Win" break print(dp[N])