結果
| 問題 |
No.3112 Decrement or Mod Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-20 01:24:46 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 568 bytes |
| コンパイル時間 | 383 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2025-04-20 01:24:51 |
| 合計ジャッジ時間 | 3,883 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 19 WA * 46 |
ソースコード
def game_winner(A, B):
alice_turn = True # True means Alice's turn, False means Bob's turn
while A > 0 and B > 0:
if alice_turn:
x, y = A, B
else:
x, y = B, A
# Check if modulo operation is allowed
if x >= y and y != 0:
x %= y
else:
x -= 1
if alice_turn:
A = x
else:
B = x
alice_turn = not alice_turn
return "Bob" if A == 0 else "Alice"
# Input
A, B = map(int, input().split())
# Output
print(game_winner(A, B))