結果
問題 |
No.524 コインゲーム
|
ユーザー |
|
提出日時 | 2021-03-12 18:07:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 422 bytes |
コンパイル時間 | 1,819 ms |
コンパイル使用メモリ | 191,576 KB |
最終ジャッジ日時 | 2025-01-19 13:54:25 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n; cin >> n; long long ret = 0; for (int i = 0; i < 50; i++) { long long bit = (n >> (i + 1)) << i; if (n & (1LL<<i)) bit += (n & ((1LL<<i) - 1)) + 1; if (bit & 1) ret |= 1LL << i; } if (ret) cout << "O" << endl; else cout << "X" << endl; return 0; }