結果

問題 No.7 プライムナンバーゲーム
コンテスト
ユーザー けむけむ
提出日時 2021-06-23 04:36:18
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 607 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 550 ms
コンパイル使用メモリ 20,956 KB
実行使用メモリ 30,964 KB
最終ジャッジ日時 2026-03-09 06:54:24
合計ジャッジ時間 33,488 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 TLE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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