結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
![]() |
提出日時 | 2020-11-24 05:37:14 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 44 ms / 5,000 ms |
コード長 | 737 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 57,472 KB |
最終ジャッジ日時 | 2024-07-23 18:23:16 |
合計ジャッジ時間 | 2,525 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
def prime_factorize(N): #素因数分解 exponent = 0 while N%2 == 0: exponent += 1 N //= 2 if exponent: factorization = [[2,exponent]] else: factorization = [] i=1 while i*i <=N: i += 2 if N%i: continue exponent = 0 while N%i == 0: exponent += 1 N //= i factorization.append([i,exponent]) if N!= 1: factorization.append([N,1]) assert N != 0, "zero" return factorization # coding: utf-8 # Your code here! import sys readline = sys.stdin.readline read = sys.stdin.read #a,b,c = map(int,readline().split()) n = int(input()) fac = prime_factorize(n) nim = 0 for p,e in fac: nim ^= e print("Alice" if nim else "Bob")