結果
問題 | No.153 石の山 |
ユーザー |
![]() |
提出日時 | 2016-04-11 14:33:39 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 983 bytes |
コンパイル時間 | 683 ms |
コンパイル使用メモリ | 83,516 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-14 14:40:21 |
合計ジャッジ時間 | 1,568 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
/* -*- coding: utf-8 -*- * * 153.cc: No.153 石の山 - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ const int MAX_N = 100; /* typedef */ typedef vector<int> vi; /* global variables */ int gndys[MAX_N + 1]; bool used[MAX_N + 1]; /* subroutines */ /* main */ int main() { int n; cin >> n; gndys[0] = gndys[1] = 0; for (int i = 2; i <= n; i++) { memset(used, false, sizeof(used)); used[gndys[i / 2] ^ gndys[(i + 1) / 2]] = true; if (i >= 3) used[gndys[i / 3] ^ gndys[(i + 1) / 3] ^ gndys[(i + 2) / 3]] = true; for (gndys[i] = 0; used[gndys[i]]; gndys[i]++); } printf("%c\n", (gndys[n] != 0) ? 'A' : 'B'); return 0; }