結果
| 問題 | No.2 素因数ゲーム |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-04-15 05:04:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,059 ms / 5,000 ms |
| コード長 | 474 bytes |
| コンパイル時間 | 277 ms |
| コンパイル使用メモリ | 82,200 KB |
| 実行使用メモリ | 81,268 KB |
| 最終ジャッジ日時 | 2024-10-04 17:06:43 |
| 合計ジャッジ時間 | 4,457 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
ソースコード
def factorize(n):
p = 2
while p * p <= n:
while n % p == 0:
yield p
n //= p
p += 1
if n > 1:
yield n
N = int(input())
ps = set(factorize(N))
def f(turn, n: int) -> bool:
if n == 1:
return False
res = False
for p in ps:
x = n
while x % p == 0:
x //= p
res |= not f(turn ^ 1, x)
return res
if f(0, N):
print('Alice')
else:
print('Bob')
norioc