問題一覧 > 通常問題

No.3112 Decrement or Mod Game

レベル : / AI推定難易度 : 1550 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 82
作問者 : Naru820 / テスター : kenken714 ponjuice Nzt3
お気に入りにしたユーザー ProblemId : 12114 / 自分の提出
問題文最終更新日: 2025-04-16 00:53:56
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
CPCTF 2025 : PPC (順位表) の他の問題:

Problem Statement

Alice and Bob have positive integers $A,B$, respectively. The two play a game with these numbers.

Starting with Alice, the two alternately perform one of the following operations until the number held by either of them becomes 0.

  • Decrease your own number by 1.
  • Replace your own number with the remainder when it is divided by the opponent's number. This operation can be performed only when the opponent's number is less than or equal to your own number.

The player whose own number becomes 0 first wins. When both players act optimally, who wins?

It can be proved that this game always comes to an end.

Constraints

  • $1 \leq A,B \leq 10^{18}$

Input

The input is given from standard input in the following format.

$A$ $B$

Output

Print the name of the winner (Alice or Bob) on one line.

Sample

Sample 1
Input
5 3
Output
Alice

Here is one example of how the game may proceed.

  • Alice performs the operation of replacing her number with the remainder when it is divided by the opponent's number. $A$ becomes $2$.
  • Bob performs the operation of decreasing his number by 1. $B$ becomes $2$.
  • Alice performs the operation of replacing her number with the remainder when it is divided by the opponent's number. $A$ becomes $0$. The game ends with Alice as the winner.

In this example, the players are not necessarily acting optimally, but it can be proved that Alice wins even when both players act optimally.

Sample 2
Input
2 9
Output
Bob
Sample 3
Input
271828459045235602 314159265358979323
Output
Bob

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。