結果

問題 No.2 素因数ゲーム
ユーザー noriocnorioc
提出日時 2024-04-15 05:04:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,362 ms / 5,000 ms
コード長 474 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 82,588 KB
実行使用メモリ 81,260 KB
最終ジャッジ日時 2024-04-15 05:05:02
合計ジャッジ時間 5,102 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,440 KB
testcase_01 AC 36 ms
52,952 KB
testcase_02 AC 36 ms
52,756 KB
testcase_03 AC 36 ms
53,316 KB
testcase_04 AC 36 ms
52,940 KB
testcase_05 AC 37 ms
52,520 KB
testcase_06 AC 37 ms
53,972 KB
testcase_07 AC 87 ms
76,264 KB
testcase_08 AC 38 ms
59,260 KB
testcase_09 AC 1,293 ms
79,008 KB
testcase_10 AC 42 ms
59,928 KB
testcase_11 AC 55 ms
65,392 KB
testcase_12 AC 107 ms
76,048 KB
testcase_13 AC 1,362 ms
81,260 KB
testcase_14 AC 36 ms
53,140 KB
testcase_15 AC 40 ms
57,820 KB
testcase_16 AC 40 ms
58,380 KB
testcase_17 AC 36 ms
53,008 KB
testcase_18 AC 37 ms
52,404 KB
testcase_19 AC 39 ms
57,992 KB
testcase_20 AC 40 ms
58,472 KB
testcase_21 AC 40 ms
57,948 KB
testcase_22 AC 40 ms
58,116 KB
testcase_23 AC 36 ms
52,280 KB
testcase_24 AC 39 ms
57,880 KB
testcase_25 AC 38 ms
57,672 KB
testcase_26 AC 37 ms
52,196 KB
testcase_27 AC 44 ms
60,472 KB
testcase_28 AC 37 ms
52,536 KB
testcase_29 AC 38 ms
52,316 KB
testcase_30 AC 44 ms
57,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorize(n):
    p = 2
    while p * p <= n:
        while n % p == 0:
            yield p
            n //= p
        p += 1
    if n > 1:
        yield n


N = int(input())
ps = set(factorize(N))


def f(turn, n: int) -> bool:
    if n == 1:
        return False

    res = False
    for p in ps:
        x = n
        while x % p == 0:
            x //= p
            res |= not f(turn ^ 1, x)

    return res


if f(0, N):
    print('Alice')
else:
    print('Bob')
0