結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,840 KB
testcase_01 AC 16 ms
7,960 KB
testcase_02 AC 2,686 ms
8,244 KB
testcase_03 AC 178 ms
8,208 KB
testcase_04 AC 55 ms
7,924 KB
testcase_05 WA -
testcase_06 AC 733 ms
8,212 KB
testcase_07 AC 502 ms
8,296 KB
testcase_08 AC 229 ms
7,736 KB
testcase_09 WA -
testcase_10 AC 15 ms
7,808 KB
testcase_11 AC 502 ms
8,208 KB
testcase_12 AC 1,843 ms
8,272 KB
testcase_13 AC 1,921 ms
8,300 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2,273 ms
8,248 KB
権限があれば一括ダウンロードができます

ソースコード

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-1] == 0:
    print("Lose")
else:
    print("Win")
0