結果

問題 No.7 プライムナンバーゲーム
ユーザー togatogatogatoga
提出日時 2015-08-15 07:40:36
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 1,020 ms
コンパイル使用メモリ 77,612 KB
実行使用メモリ 88,184 KB
最終ジャッジ日時 2023-09-25 11:57:19
合計ジャッジ時間 4,672 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
77,260 KB
testcase_01 AC 77 ms
77,048 KB
testcase_02 AC 257 ms
87,568 KB
testcase_03 AC 95 ms
80,312 KB
testcase_04 AC 91 ms
79,740 KB
testcase_05 WA -
testcase_06 AC 138 ms
82,856 KB
testcase_07 AC 121 ms
81,400 KB
testcase_08 AC 93 ms
80,588 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 121 ms
81,484 KB
testcase_12 AC 210 ms
85,084 KB
testcase_13 AC 217 ms
85,200 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 237 ms
85,792 KB
権限があれば一括ダウンロードができます

ソースコード

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