結果

問題 No.3112 Decrement or Mod Game
ユーザー Mistletoe
提出日時 2025-04-19 03:28:13
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 515 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2025-04-19 03:28:18
合計ジャッジ時間 4,088 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 30 WA * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

def determine_winner(A, B):
    if A == 0 or B == 0:
        return "Alice" if A == 0 else "Bob"
    
    if A < B:
        return determine_winner(B, A)
    
    if A // B >= 2:
        return "Alice"
    else:
        return "Bob" if determine_winner(B, A % B) == "Bob" else "Alice"

A, B = map(int, input().split())
if A == 0 or B == 0:
    print("Alice" if A == 0 else "Bob")
else:
    if A < B:
        A, B = B, A
    if determine_winner(A, B) == "Alice":
        print("Alice")
    else:
        print("Bob")
0