結果

問題 No.2 素因数ゲーム
ユーザー noriocnorioc
提出日時 2024-04-15 05:08:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,917 ms / 5,000 ms
コード長 418 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 82,304 KB
最終ジャッジ日時 2024-04-15 05:08:45
合計ジャッジ時間 6,075 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,224 KB
testcase_01 AC 40 ms
52,352 KB
testcase_02 AC 40 ms
51,840 KB
testcase_03 AC 45 ms
59,288 KB
testcase_04 AC 38 ms
51,968 KB
testcase_05 AC 45 ms
58,616 KB
testcase_06 AC 42 ms
51,992 KB
testcase_07 AC 85 ms
75,648 KB
testcase_08 AC 42 ms
56,912 KB
testcase_09 AC 1,917 ms
82,304 KB
testcase_10 AC 45 ms
58,112 KB
testcase_11 AC 56 ms
64,256 KB
testcase_12 AC 115 ms
76,160 KB
testcase_13 AC 1,659 ms
80,512 KB
testcase_14 AC 40 ms
52,096 KB
testcase_15 AC 43 ms
57,600 KB
testcase_16 AC 43 ms
57,472 KB
testcase_17 AC 39 ms
52,096 KB
testcase_18 AC 39 ms
52,096 KB
testcase_19 AC 42 ms
57,216 KB
testcase_20 AC 42 ms
57,088 KB
testcase_21 AC 42 ms
56,960 KB
testcase_22 AC 41 ms
57,088 KB
testcase_23 AC 38 ms
52,352 KB
testcase_24 AC 42 ms
56,832 KB
testcase_25 AC 42 ms
57,216 KB
testcase_26 AC 41 ms
52,096 KB
testcase_27 AC 56 ms
63,104 KB
testcase_28 AC 44 ms
57,728 KB
testcase_29 AC 51 ms
52,224 KB
testcase_30 AC 46 ms
57,216 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(n: int) -> bool:
    res = False
    for p in ps:
        x = n
        while x % p == 0:
            x //= p
            res |= not f(x)

    return res


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