結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
dashi_dragons
|
| 提出日時 | 2017-02-14 22:44:08 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 813 ms / 5,000 ms |
| コード長 | 541 bytes |
| コンパイル時間 | 351 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,520 KB |
| 最終ジャッジ日時 | 2024-10-01 15:56:04 |
| 合計ジャッジ時間 | 6,434 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
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] == True:
print('Win')
else:
print('Lose')
dashi_dragons