結果

問題 No.7 プライムナンバーゲーム
ユーザー maatanbetamaatanbeta
提出日時 2017-05-12 17:19:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 581 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 12,744 KB
最終ジャッジ日時 2023-10-13 13:55:56
合計ジャッジ時間 6,711 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,936 KB
testcase_01 AC 15 ms
7,776 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 #

N = int(input())


def sosuuhan(N):
    sosuu = []
    for i in range(N):
        if i == 0 or i == 1:
            continue
        prime = True
        for k in sosuu:
            if i % k == 0:
                prime = False
                break
        if prime:
            sosuu.append(i)
    return sosuu


kachi = [False] * (N + 1)
kachi[0] = True
kachi[1] = True
for k in range(N):
    if k == 0 or k == 1 or kachi[k]:
        continue
    for i in sosuuhan(N):
        if k + i <= N:
            kachi[k + i] = True

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