結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
|
提出日時 | 2021-04-24 10:25:54 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 889 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-04 09:02:39 |
合計ジャッジ時間 | 2,126 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 4 |
ソースコード
from collections import Counter def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n % i == 0: n = n//i table.append(i) i += 1 if n > 1: table.append(n) return table N = int(input()) prime = prime_decomposition(N) d = Counter() d.update(prime) cnt_one = 0 cnt_multi = 0 for key in d: if d[key] > 1: cnt_multi += 1 else: cnt_one += 1 if cnt_one > 0 and cnt_multi == 0: if cnt_one%2: print("Alice") else: print("Bob") elif cnt_one == 0 and cnt_multi > 0: if cnt_multi%2: print("Alice") else: print("Bob") else: if cnt_one%2: if cnt_multi%2: print("Alice") else: print("Bob") else: if cnt_multi%2: print("Alice") else: print("Bob")