結果
| 問題 | No.2 素因数ゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-12 01:06:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 5,000 ms |
| コード長 | 672 bytes |
| 記録 | |
| コンパイル時間 | 207 ms |
| コンパイル使用メモリ | 81,664 KB |
| 実行使用メモリ | 57,728 KB |
| 最終ジャッジ日時 | 2024-11-24 01:13:40 |
| 合計ジャッジ時間 | 2,989 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
ソースコード
def factorization(n):
if n==1:
return []
arr = []
tmp = n
for i in range(2,4):
if tmp%i==0:
cnt=0
while(tmp%i==0):
cnt+=1
tmp//=i
arr.append(cnt)
for i in range(5, int(-(-tmp**0.5//1))+1,2):
if tmp%i==0:
cnt=0
while tmp%i==0:
cnt+=1
tmp //= i
arr.append(cnt)
if tmp!=1:
arr.append(1)
if arr==[]:
arr.append(1)
return arr
n=int(input())
prime=factorization(n)
ans=0
for x in prime:
ans^=x
if ans:
print("Alice")
else:
print("Bob")