結果

問題 No.7 プライムナンバーゲーム
ユーザー dashi_dragons
提出日時 2017-02-14 22:42:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 543 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-12-29 22:35:42
合計ジャッジ時間 7,268 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys

def cal_prm(N):
	
	prm = []
	
	for i in range(2,N):
		flag = True

		for j in range(2,i):
			if i % j == 0:
				flag = False
				break
		if flag == True:
			prm.append(i)
	return prm

def judge(N):

	list = {2:False,3:False}
	prm = cal_prm(N)

	for i in range(4,N+1):

		flag = True
		for j in prm:
			if i - j < 2:
				break
	
			if list[i-j] == False:
				list[i] = True
				break

		if i not in list:	
			list[i] = False

	return list

N = int(input())

if judge(N)[N-1] == True:
	print('Win')
else:
	print('Lose')	
0