結果
問題 | No.524 コインゲーム |
ユーザー | tom |
提出日時 | 2017-06-02 23:48:04 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 490 bytes |
コンパイル時間 | 875 ms |
コンパイル使用メモリ | 72,680 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-02 10:25:51 |
合計ジャッジ時間 | 1,873 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#pragma GCC optimize("O3") #pragma GCC target("avx") #include <iostream> #include <vector> #include <string> #include <algorithm> #include <stack> #include <queue> #include <set> #include <map> using namespace std; int main() { long long n; cin >> n; bool zero = true; for (int i = 0; i < 32; i++) { long long cnt = n / (1LL << i + 1) * (1LL << i) + max(0LL, n % (1LL << i + 1) - (1LL << i) + 1); if (cnt % 2 != 0) { zero = false; } } cout << (zero ? "X" : "O") << endl; }