結果

問題 No.7 プライムナンバーゲーム
ユーザー けむけむけむけむ
提出日時 2021-06-23 04:36:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 607 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,804 KB
実行使用メモリ 8,768 KB
最終ジャッジ日時 2023-09-06 05:03:16
合計ジャッジ時間 7,938 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,872 KB
testcase_01 AC 15 ms
7,856 KB
testcase_02 AC 209 ms
8,580 KB
testcase_03 AC 33 ms
7,848 KB
testcase_04 AC 19 ms
7,888 KB
testcase_05 AC 191 ms
8,348 KB
testcase_06 AC 77 ms
8,248 KB
testcase_07 AC 57 ms
8,292 KB
testcase_08 AC 35 ms
8,292 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def sosu(N):
    nums = [n for n in range(2, N + 1)]
    i = 0
    while i <= len(nums) - 1:
        j = i + 1
        while j <= len(nums) - 1:
            if nums[j] % nums[i] == 0:
                nums.pop(j)
            else:
                j = j + 1
        i += 1
    return nums

def check(N):
    sosus = sosu(N)
    if (N == 0) or (N == 1):
        return 'Win'
    for i in range(1, len(sosus) + 1):
        s = sosus[-i]
        c = check(N - s)
        if c == 'Lose':
            return 'Win'
    else:
        return 'Lose'

if __name__ == '__main__':
    N = int(input())
    print(check(N))
0