結果

問題 No.7 プライムナンバーゲーム
ユーザー asaka189asaka189
提出日時 2018-01-02 13:59:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,863 ms / 5,000 ms
コード長 399 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-09 04:26:48
合計ジャッジ時間 20,101 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,880 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 2,839 ms
11,008 KB
testcase_03 AC 200 ms
10,880 KB
testcase_04 AC 73 ms
10,880 KB
testcase_05 AC 74 ms
10,752 KB
testcase_06 AC 826 ms
10,752 KB
testcase_07 AC 564 ms
10,752 KB
testcase_08 AC 260 ms
10,880 KB
testcase_09 AC 1,263 ms
10,880 KB
testcase_10 AC 29 ms
10,752 KB
testcase_11 AC 578 ms
10,752 KB
testcase_12 AC 2,045 ms
10,880 KB
testcase_13 AC 2,159 ms
10,880 KB
testcase_14 AC 2,863 ms
11,008 KB
testcase_15 AC 2,713 ms
10,880 KB
testcase_16 AC 2,438 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
table = [0 for i in range(n)]

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 k != l and i-p[k] > 1:
		if table[i-p[k]-1] == 0:
			table[i-1] = 'Win'
			k += 1
		else:
			k += 1

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