結果
| 問題 |
No.524 コインゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-05 14:53:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 3,313 bytes |
| コンパイル時間 | 1,104 ms |
| コンパイル使用メモリ | 100,472 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-22 11:10:15 |
| 合計ジャッジ時間 | 2,277 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>
#include <random>
//#include <atcoder/convolution>
//#include <atcoder/math>
//#include <atcoder/maxflow>
//#include <atcoder/mincostflow>
//#include <atcoder/modint>
//#include <atcoder/scc>
//#include <atcoder/string>
//#include <atcoder/twosat>
//using namespace atcoder;
using namespace std;
// マクロ&定数&関数 ================================================
typedef int Int;
typedef int INt;
typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;
typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vpint> vvpint;
typedef vector<vpll> vvpll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<string>> vvstring;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<vector<vector<pll>>> vvvpll;
typedef vector<vector<vector<bool>>> vvvbool;
typedef vector<vector<vector<double>>> vvvdouble;
typedef vector<vector<vector<vector<double>>>> vvvvdouble;
const ll LLINF = 1e18 + 1;
const int DX[9] = { 0, 0, 1, -1, 1, 1, -1, -1, 0 }; // 4;4近傍
const int DY[9] = { 1, -1, 0, 0, 1, -1, 1, -1, 0 }; // 8:8近傍 9:(0,0)を含む
const double PI = 3.14159265358979323846264338327950288;
const double EPS = 1e-7;
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
const ll MOD = 1000000007; //10^9 + 7
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } else return false; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } else return false; }
//---------------------------------------------------------------
// オーバーフローチェック
//---------------------------------------------------------------
bool is_overflow(ll a, ll b) {
ll M = numeric_limits<ll>::max();
return (a >= M / b);
}
//---------------------------------------------------------------
// XORの階乗 0^1^...^N (O(1))
//---------------------------------------------------------------
ll xor_fac(ll N)
{
if (N == 0) return 0;
ll n_pair = (N - 1) / 2;
ll n_one = n_pair + 1;
if (n_pair * 2 + 1 == N) {
return n_one % 2;
}
else {
return (n_one % 2) ^ N;
}
}
int main() {
//////==================================
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(25);
//////==================================
/*
~思いついたことはとりあえず絶対メモする!!~
~オーバーフローに注意!!!~
*/
ll N;
cin >> N;
ll ans = xor_fac(N);
cout << (ans != 0 ? "O" : "X") << endl;
}