結果

問題 No.2 素因数ゲーム
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2020-01-21 01:19:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 818 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 10,820 KB
実行使用メモリ 8,440 KB
最終ジャッジ日時 2023-09-15 22:08:14
合計ジャッジ時間 1,875 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,260 KB
testcase_01 AC 19 ms
8,372 KB
testcase_02 AC 19 ms
8,272 KB
testcase_03 AC 19 ms
8,344 KB
testcase_04 AC 19 ms
8,332 KB
testcase_05 AC 20 ms
8,260 KB
testcase_06 AC 19 ms
8,404 KB
testcase_07 AC 19 ms
8,352 KB
testcase_08 AC 19 ms
8,272 KB
testcase_09 AC 19 ms
8,328 KB
testcase_10 AC 19 ms
8,180 KB
testcase_11 AC 19 ms
8,244 KB
testcase_12 AC 19 ms
8,264 KB
testcase_13 AC 19 ms
8,400 KB
testcase_14 AC 19 ms
8,332 KB
testcase_15 AC 19 ms
8,176 KB
testcase_16 AC 19 ms
8,260 KB
testcase_17 AC 19 ms
8,180 KB
testcase_18 AC 19 ms
8,400 KB
testcase_19 AC 19 ms
8,304 KB
testcase_20 AC 19 ms
8,440 KB
testcase_21 AC 19 ms
8,300 KB
testcase_22 AC 19 ms
8,368 KB
testcase_23 AC 18 ms
8,252 KB
testcase_24 AC 18 ms
8,348 KB
testcase_25 AC 19 ms
8,180 KB
testcase_26 AC 18 ms
8,264 KB
testcase_27 AC 18 ms
8,328 KB
testcase_28 AC 19 ms
8,304 KB
testcase_29 AC 19 ms
8,400 KB
testcase_30 AC 18 ms
8,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Sieve(n): #n以下の素数全列挙(O(nloglogn)) retは素数が入ってる。divlisはその数字の素因数が一つ入ってる

    ret = []
    divlis = [-1] * (n+1) #何で割ったかのリスト(初期値は-1)
    
    flag = [True] * (n+1)
    flag[0] = False
    flag[1] = False

    ind = 2
    while ind <= n:

        if flag[ind]:
            ret.append(ind)

            ind2 = ind ** 2

            while ind2 <= n:
                flag[ind2] = False
                divlis[ind2] = ind
                ind2 += ind

        ind += 1

    return ret,divlis


N = int(input())

ret,divs = Sieve(10000)

ans = 0

for i in ret:

    now = 0

    while N % i == 0:
        N //= i
        now += 1

    ans ^= now

if N != 1:
    ans ^= 1

if ans == 0:
    print ("Bob")
else:
    print ("Alice")

0