結果

問題 No.7 プライムナンバーゲーム
ユーザー pekempeypekempey
提出日時 2015-08-23 17:34:39
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,332 ms / 5,000 ms
コード長 387 bytes
コンパイル時間 684 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,696 KB
最終ジャッジ日時 2024-04-09 03:50:54
合計ジャッジ時間 11,234 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
6,568 KB
testcase_01 AC 15 ms
6,688 KB
testcase_02 AC 1,332 ms
6,692 KB
testcase_03 AC 224 ms
6,688 KB
testcase_04 AC 107 ms
6,688 KB
testcase_05 AC 105 ms
6,688 KB
testcase_06 AC 572 ms
6,692 KB
testcase_07 AC 441 ms
6,692 KB
testcase_08 AC 270 ms
6,692 KB
testcase_09 AC 755 ms
6,692 KB
testcase_10 AC 16 ms
6,688 KB
testcase_11 AC 447 ms
6,688 KB
testcase_12 AC 1,049 ms
6,692 KB
testcase_13 AC 1,098 ms
6,696 KB
testcase_14 AC 1,328 ms
6,692 KB
testcase_15 AC 1,283 ms
6,688 KB
testcase_16 AC 1,215 ms
6,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10005)

N = int(raw_input())

prime = []
good = [True] * 10101

for i in xrange(2, 10101):
	if good[i]:
		prime.append(i)
		for j in xrange(i * i, 10101, i):
			good[j] = False

dp = [None]	* (N + 1)

dp[0] = True
dp[1] = True

for i in xrange(2, N + 1):
	dp[i] = any([not dp[i - j] for j in prime if j <= i])

if dp[N]:
	print "Win"
else:
	print "Lose"
0