結果
| 問題 |
No.3112 Decrement or Mod Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-20 01:33:27 |
| 言語 | C++17(gnu拡張) (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 530 bytes |
| コンパイル時間 | 647 ms |
| コンパイル使用メモリ | 67,252 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-04-20 01:33:30 |
| 合計ジャッジ時間 | 2,716 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 32 WA * 33 |
ソースコード
#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 ? "Bob" : "Alice";
} else {
return turn == 0 ? "Alice" : "Bob";
}
}
a %= b;
turn ^= 1;
}
}
int main() {
long long A, B;
cin >> A >> B;
cout << solve(A, B) << endl;
return 0;
}