結果
問題 |
No.7 プライムナンバーゲーム
|
ユーザー |
|
提出日時 | 2021-06-21 11:20:36 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 489 bytes |
コンパイル時間 | 194 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-06-22 22:47:25 |
合計ジャッジ時間 | 1,775 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 5 RE * 12 |
ソースコード
N = int(input()) hurui = set(range(2, N+1)) for i in range(2, N+1): for j in range(i*2, N+1, i): hurui.discard(j) dp = [-1]*(N+10) dp[0] = 0 dp[1] = 0 def grundy(x): if dp[x] != -1: return dp[x] s = set() for i in range(2, x+1): if i in hurui: s.add(grundy(x-i)) for i in range(x+1): if i not in s: dp[x] = i print(x, i) return i if grundy(N)&1: print("Lose") else: print("Win")