結果
問題 | No.153 石の山 |
ユーザー |
![]() |
提出日時 | 2018-01-05 14:59:39 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 708 bytes |
コンパイル時間 | 856 ms |
コンパイル使用メモリ | 63,444 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 06:02:02 |
合計ジャッジ時間 | 2,187 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 WA * 8 |
ソースコード
#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++) { set<int> s; if (x % 2 == 0) s.insert(g[x / 2] ^ g[x / 2]); else s.insert(g[x / 2] ^ g[x / 2 + 1]); if (x % 3 == 0) s.insert(g[x / 3] ^ g[x / 3] ^ g[x ^ 3]); else if (x % 3 == 1) s.insert(g[x / 3] ^ g[x / 3] ^ g[x / 3 + 1]); else s.insert(g[x / 3] ^ g[x / 3 + 1] ^ g[x / 3 + 1]); int num = 0; for (int n : s) { if (num != n) break; num++; } g[x] = num; } if (g[N]) cout << "A" << endl; else cout << "B" << endl; return 0; }