結果

問題 No.7 プライムナンバーゲーム
ユーザー Shin09shinShin09shin
提出日時 2019-01-26 18:31:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 468 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 11,900 KB
実行使用メモリ 14,664 KB
最終ジャッジ日時 2023-10-17 06:48:32
合計ジャッジ時間 6,681 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

n = int(input())
x = [-1] * (n + 1)
x[0], x[1] = 1, 1
for i in range(2, n + 1):
    for j in range(1, n):
        if is_prime(n):            
            if j > i:
                break
            if x[i - j] == -1:
                x[i] = 1
if x[-1] == 1:
    print('Win')
else:
    print('Lose')
0