結果

問題 No.3112 Decrement or Mod Game
ユーザー Mistletoe
提出日時 2025-04-19 00:56:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 544 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2025-04-19 00:56:13
合計ジャッジ時間 3,470 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 45 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

A, B = map(int, input().split())

def determine_winner(a, b):
    if a == 0 or b == 0:
        return "Alice" if a == 0 else "Bob"
    turn = 0  # 0 for Alice's turn, 1 for Bob's
    while True:
        if a == 0 or b == 0:
            return "Alice" if a == 0 else "Bob"
        if a >= 2 * b:
            return "Alice" if turn == 0 else "Bob"
        if b >= 2 * a:
            return "Bob" if turn == 0 else "Alice"
        if a > b:
            a = a % b
        else:
            b = b % a
        turn ^= 1

print(determine_winner(A, B))
0