結果

問題 No.7 プライムナンバーゲーム
ユーザー pekempey
提出日時 2015-08-23 17:28:18
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 407 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2024-07-18 12:52:30
合計ジャッジ時間 1,202 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 RE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

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

memo = [None] * 10101

def judge(n):
	global memo
	if n <= 1: return True
	if not memo[n] is None: return memo[n]
	memo[n] = any([not judge(n - p) for p in prime if p <= n])
	return memo[n]

if judge(N):
	print "Win"
else:
	print "Lose"
0