結果

問題 No.7 プライムナンバーゲーム
ユーザー zinnnia123zinnnia123
提出日時 2019-09-01 23:12:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 458 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 8,424 KB
最終ジャッジ日時 2023-08-19 23:12:51
合計ジャッジ時間 18,919 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

N = int(input())

LC = [0]*N
LC[0] = 1
LC[1] = 1

pn = [2]
for L in range(3, N):
    chk = True
    for L2 in pn:
        if L%L2 == 0:chk = False
    if chk == True:pn.append(L)

for i in range(2,N):
    A = list(filter(lambda x: x <= i, pn))
    B = [0]*len(A)
    flag = True
    for j in range(len(A)):
        if LC[i - A[j]] == 0:
            flag = False
    if flag == False:
        LC[i] = 1

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