結果
問題 |
No.7 プライムナンバーゲーム
|
ユーザー |
![]() |
提出日時 | 2022-10-31 00:00:37 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 696 bytes |
コンパイル時間 | 217 ms |
コンパイル使用メモリ | 82,292 KB |
実行使用メモリ | 79,976 KB |
最終ジャッジ日時 | 2024-07-07 14:44:52 |
合計ジャッジ時間 | 2,394 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 RE * 12 |
ソースコード
from functools import lru_cache def seachPrimeNum(N): max = int(N**0.5) seachList = [i for i in range(2,N+1)] primeNum = [] while seachList[0] <= max: primeNum.append(seachList[0]) tmp = seachList[0] seachList = [i for i in seachList if i % tmp != 0] primeNum.extend(seachList) return primeNum N = int(input()) PL = seachPrimeNum(N) @lru_cache(maxsize=1000) def dfs(x): for p in PL: if x < p: break if x - p == 0 or x - p == 1: return True #print(x,x-p,dfs(x-p)) if dfs(x-p) == True: return False return True if dfs(N): print("Lose") else: print("Win")