結果

問題 No.7 プライムナンバーゲーム
ユーザー togatoga
提出日時 2015-08-15 07:39:33
言語 Python2
(2.7.18)
結果
MLE  
実行時間 -
コード長 407 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 776,064 KB
最終ジャッジ日時 2024-07-18 09:35:32
合計ジャッジ時間 13,245 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 3 MLE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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"
0