結果

問題 No.7 プライムナンバーゲーム
ユーザー asaka189asaka189
提出日時 2018-01-02 12:43:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 511 bytes
コンパイル時間 1,522 ms
コンパイル使用メモリ 10,892 KB
実行使用メモリ 16,368 KB
最終ジャッジ日時 2023-08-24 16:52:37
合計ジャッジ時間 7,397 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
16,368 KB
testcase_01 AC 16 ms
7,796 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def findp(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.append(2)
	return p

n = int(input())
p = findp(n)
identifier = 1
next = n - max(p)
while next != 3 and next != 2 and next != 1:
	pp = findp(next)
	next = next - max(p)
	identifier = identifier*-1
if next == 1 and identifier == 1:
	print('Lose')
elif next == 1 and identifier == -1:
	print('Win')
elif identifier == 1:
	print('Win')
else:
	print('Lose')
0