結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
|
提出日時 | 2024-03-16 19:16:59 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 487 bytes |
コンパイル時間 | 305 ms |
コンパイル使用メモリ | 82,500 KB |
実行使用メモリ | 59,508 KB |
最終ジャッジ日時 | 2024-09-30 04:33:25 |
合計ジャッジ時間 | 2,315 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 16 |
ソースコード
def prime_factors(n): i = 2 factors = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(i) if n > 1: factors.append(n) return factors def game_winner(n): factors = prime_factors(n) if n == 2 or len(set(factors)) == 1: return "Alice" elif len(factors) % 2 == 0 or n % 2 == 0: return "Alice" else: return "Bob" n = int(input()) print(game_winner(n))