結果
| 問題 | No.3112 Decrement or Mod Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-20 01:29:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 530 bytes |
| 記録 | |
| コンパイル時間 | 836 ms |
| コンパイル使用メモリ | 68,140 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-04-20 01:29:50 |
| 合計ジャッジ時間 | 2,556 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 33 WA * 32 |
ソースコード
#include <iostream>
using namespace std;
string solve(long long a, long long b) {
int turn = 0; // 0 = Alice, 1 = Bob
while (true) {
if (a < b) swap(a, b);
if (a % b == 0) {
if ((a / b) % 2 == 1) {
return turn == 0 ? "Alice" : "Bob";
} else {
return turn == 0 ? "Bob" : "Alice";
}
}
a %= b;
turn ^= 1;
}
}
int main() {
long long A, B;
cin >> A >> B;
cout << solve(A, B) << endl;
return 0;
}