結果
問題 |
No.3112 Decrement or Mod Game
|
ユーザー |
|
提出日時 | 2025-04-18 23:22:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 998 bytes |
コンパイル時間 | 273 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2025-04-18 23:22:13 |
合計ジャッジ時間 | 5,233 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 65 |
ソースコード
import math def determine_winner(a, b): phi = (1 + math.sqrt(5)) / 2 # Golden ratio ~1.618 current_player = True # True for Alice's turn, False for Bob's while True: if a == 0: return "Bob" if b == 0: return "Alice" if current_player: # Alice's turn if a >= b: if a % b == 0: return "Alice" if a >= b * phi: a %= b else: a -= 1 else: a -= 1 else: # Bob's turn if b >= a: if b % a == 0: return "Bob" if b >= a * phi: b %= a else: b -= 1 else: b -= 1 current_player = not current_player # Read input A = int(input()) B = int(input()) # Determine and print the winner print(determine_winner(A, B))