結果

問題 No.7 プライムナンバーゲーム
ユーザー asaka189asaka189
提出日時 2018-01-02 13:38:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 462 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 8,600 KB
最終ジャッジ日時 2023-08-24 16:53:39
合計ジャッジ時間 19,599 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,780 KB
testcase_01 AC 16 ms
7,920 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 57 ms
7,776 KB
testcase_06 WA -
testcase_07 AC 535 ms
7,708 KB
testcase_08 AC 258 ms
7,780 KB
testcase_09 AC 1,189 ms
7,888 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2,667 ms
8,600 KB
testcase_15 AC 2,628 ms
8,600 KB
testcase_16 AC 2,391 ms
8,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
table = [0 for i in range(n)]
table[1] = 'Lose' #2のとき
table[2] = 'Lose' #3のとき

p = []
for i in range(3,n):
	check = True
	for k in range(2,int(i**0.5)+2):
		if i%k == 0:
			check = False
	if check:
		p.append(i)
p.insert(0,2)

l = len(p)
for i in range(4,n+1):
	k = 0
	while i-p[k] > 1 and k != l-1:
		if table[i-p[k]-1] == 0:
			table[i-1] = 'Lose'
			k += 1
		else:
			k += 1

if table[n-1] == 0:
	print('Win')
else:
	print('Lose')
0