結果

問題 No.2 素因数ゲーム
ユーザー terasa
提出日時 2022-11-20 12:31:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 5,000 ms
コード長 862 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 68,224 KB
最終ジャッジ日時 2024-09-21 13:09:52
合計ジャッジ時間 3,802 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

from typing import List, Tuple, Optional
import sys
import itertools
import heapq
import bisect
import math
from collections import deque, defaultdict
from functools import lru_cache, cmp_to_key

input = sys.stdin.readline

if __file__ != 'prog.py':
    sys.setrecursionlimit(10 ** 6)


def readints(): return map(int, input().split())
def readlist(): return list(readints())
def readstr(): return input()[:-1]


def factorize(n) -> List[int]:
    """return prime factors of given integer"""
    f = []
    m = n
    for i in range(2, n + 1):
        if i * i > n:
            break
        while m % i == 0:
            f.append(i)
            m //= i
    if m > 1:
        f.append(m)
    return f


N = int(input())
cnt = defaultdict(int)
for f in factorize(N):
    cnt[f] += 1
acc = 0
for v in cnt.values():
    acc ^= v
print('Alice' if acc > 0 else 'Bob')
0