結果

問題 No.3112 Decrement or Mod Game
ユーザー しとりん
提出日時 2025-04-20 12:57:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 409 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2025-04-20 12:57:28
合計ジャッジ時間 3,865 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

def alice_wins(a: int, b: int) -> bool:
    flip = False 
    while True:
        if a == 1:
            res = True
            break
        if a < b:
            a, b = b, a - 1
            flip = not flip
            continue
        if a % b == 0:
            res = True
            break
        if a >= 2 * b:
            res = True
            break
        res = False if a == b + 1 else True
        break

    return (not res) if flip else res


if __name__ == "__main__":
    A, B = map(int, input().split())
    print("Alice" if alice_wins(A, B) else "Bob")
0