結果
問題 | No.7 プライムナンバーゲーム |
ユーザー | ntuda |
提出日時 | 2022-10-31 00:05:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 399 ms / 5,000 ms |
コード長 | 730 bytes |
コンパイル時間 | 316 ms |
コンパイル使用メモリ | 86,980 KB |
実行使用メモリ | 93,160 KB |
最終ジャッジ日時 | 2023-09-21 21:30:07 |
合計ジャッジ時間 | 5,560 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 99 ms
72,772 KB |
testcase_01 | AC | 97 ms
72,720 KB |
testcase_02 | AC | 399 ms
93,160 KB |
testcase_03 | AC | 143 ms
80,652 KB |
testcase_04 | AC | 129 ms
80,976 KB |
testcase_05 | AC | 131 ms
79,220 KB |
testcase_06 | AC | 216 ms
88,008 KB |
testcase_07 | AC | 190 ms
86,480 KB |
testcase_08 | AC | 160 ms
81,660 KB |
testcase_09 | AC | 249 ms
89,928 KB |
testcase_10 | AC | 101 ms
72,560 KB |
testcase_11 | AC | 190 ms
85,808 KB |
testcase_12 | AC | 299 ms
91,480 KB |
testcase_13 | AC | 316 ms
92,096 KB |
testcase_14 | AC | 385 ms
92,348 KB |
testcase_15 | AC | 359 ms
92,228 KB |
testcase_16 | AC | 354 ms
93,104 KB |
ソースコード
import sys from functools import lru_cache sys.setrecursionlimit(10000) 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=10000) 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")