結果
問題 | No.153 石の山 |
ユーザー |
![]() |
提出日時 | 2018-01-05 18:32:06 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 831 bytes |
コンパイル時間 | 533 ms |
コンパイル使用メモリ | 57,332 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 06:08:58 |
合計ジャッジ時間 | 1,332 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
#include <iostream>#include <set>using namespace std;int g[110];int main() {int N;cin >> N;g[2] = 1;for (int x = 3; x <= N; x++) {bool used[110] = {};if (x % 2 == 0) used[0] = true;else used[g[x / 2] ^ g[x / 2 + 1]] = true;if (x % 3 == 0) used[g[x / 3]] = true;else if (x % 3 == 1) used[g[x / 3 + 1]] = true;else used[g[x / 3]] = true;for (int n = 0; ; n++) {if (!used[n]) {g[x] = n;break;}}}/*for (int n = 2; n <= 10; n++) {cout << n << " ";if (g[n]) cout << "A" << endl;else cout << "B" << endl;cout << g[n] << endl;}*/if (g[N]) cout << "A" << endl;else cout << "B" << endl;return 0;}