結果

問題 No.7 プライムナンバーゲーム
ユーザー 双六双六
提出日時 2019-04-05 23:15:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,234 ms / 5,000 ms
コード長 444 bytes
コンパイル時間 610 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-09 04:37:23
合計ジャッジ時間 9,948 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
11,008 KB
testcase_01 AC 38 ms
11,008 KB
testcase_02 AC 1,184 ms
10,880 KB
testcase_03 AC 109 ms
11,008 KB
testcase_04 AC 57 ms
11,008 KB
testcase_05 AC 57 ms
11,008 KB
testcase_06 AC 365 ms
10,880 KB
testcase_07 AC 284 ms
11,008 KB
testcase_08 AC 138 ms
11,008 KB
testcase_09 AC 537 ms
11,008 KB
testcase_10 AC 39 ms
11,008 KB
testcase_11 AC 274 ms
10,880 KB
testcase_12 AC 879 ms
11,008 KB
testcase_13 AC 921 ms
11,008 KB
testcase_14 AC 1,167 ms
10,880 KB
testcase_15 AC 1,234 ms
11,008 KB
testcase_16 AC 1,100 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

L = [1 for i in range(10001)]
L[0] = 0
L[1] = 0
plist = []
for i in range(10001):
	if L[i] == 1:
		plist.append(i)
		c = 2
		while True:
			if i * c <= 10000:
				L[i * c] = 0
				c += 1
			else:
				break

ans = [1 for i in range(N + 1)]
for i in range(2, N + 1):
	judge = 0
	for j in plist:
		if j > i:
			break
		else:
			if ans[i - j] == 0:
				judge = 1
	ans[i] = judge

if ans[N] == 0:
	print("Lose")
else:
	print("Win")
0