結果

問題 No.7 プライムナンバーゲーム
ユーザー togatogatogatoga
提出日時 2015-08-15 07:39:33
言語 Python2
(2.7.18)
結果
MLE  
実行時間 -
コード長 407 bytes
コンパイル時間 749 ms
コンパイル使用メモリ 6,668 KB
実行使用メモリ 774,968 KB
最終ジャッジ日時 2023-09-25 11:57:07
合計ジャッジ時間 14,862 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,360 KB
testcase_01 AC 13 ms
6,360 KB
testcase_02 MLE -
testcase_03 AC 113 ms
40,664 KB
testcase_04 AC 32 ms
12,556 KB
testcase_05 WA -
testcase_06 AC 484 ms
203,308 KB
testcase_07 AC 325 ms
132,004 KB
testcase_08 AC 149 ms
56,256 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 328 ms
133,872 KB
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
権限があれば一括ダウンロードができます

ソースコード

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