結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
togatoga
|
| 提出日時 | 2015-08-15 07:40:36 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 407 bytes |
| コンパイル時間 | 1,310 ms |
| コンパイル使用メモリ | 76,300 KB |
| 実行使用メモリ | 85,692 KB |
| 最終ジャッジ日時 | 2024-07-18 09:35:39 |
| 合計ジャッジ時間 | 4,461 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 WA * 5 |
ソースコード
import sys
sys.setrecursionlimit(1 << 30)
N = input()
dp = [-1 for i in range(10010)]
def memo(pos):
if (pos == 0 or pos == 1):
return True
win = False
if (dp[pos] >= 0):
return dp[pos]
for i in range(2, pos):
if (i * i > pos):
break
win |= not memo(pos - i)
dp[pos] = win
return win
if (memo(N)):
print "Win"
else:
print "Lose"
togatoga