結果

問題 No.3112 Decrement or Mod Game
ユーザー Alph(その辺の大学生A)
提出日時 2025-04-20 01:21:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 830 bytes
コンパイル時間 803 ms
コンパイル使用メモリ 66,236 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-20 01:21:16
合計ジャッジ時間 2,987 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 52 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>

using namespace std;
int main() {
    int64_t A, B;
    cin >> A >> B;
	int i = 0;
    bool alice_turn = true;

    while (A > 0 && B > 0) {
        if (alice_turn) {
        	i++;
            if (A >= B && B != 0) {
            	if (A % B != 1) {
                	A %= B;
            	}
            } else {
                A--;
            }
        } else {
            if (B >= A && A != 0) {
            	if (B % A != 1) {
                	B %= A;
            	}
            } else {
                B--;
            }
        }
        alice_turn = !alice_turn;
    }

    if (A == 0) {
        cout << "Alice" << endl; // Aliceが先に0になったのでBobの勝ち
    } else {
        cout << "Bob" << endl; // Bobが先に0になったのでAliceの勝ち
    }
    return 0;
}
0