結果

問題 No.2 素因数ゲーム
ユーザー marroncastle
提出日時 2020-09-19 01:22:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 368 bytes
コンパイル時間 633 ms
コンパイル使用メモリ 82,180 KB
実行使用メモリ 60,864 KB
最終ジャッジ日時 2024-06-22 15:23:17
合計ジャッジ時間 2,412 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#素因数分解、計算量はO(√N)
from collections import defaultdict
def factorize(n):
  dic = defaultdict(lambda: 0)
  b = 2
  while b * b <= n:
    while n % b == 0:
      n //= b
      dic[b] += 1
    b += 1
  if n > 1:
    dic[n] += 1
  return dic

N = int(input())
d = factorize(N)
ans = 0
for v in d.values():
  ans ^= v
print('Bob' if ans==0 else 'Alice')
0