結果
問題 |
No.153 石の山
|
ユーザー |
![]() |
提出日時 | 2015-02-16 02:14:55 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 542 bytes |
コンパイル時間 | 1,307 ms |
コンパイル使用メモリ | 158,596 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-14 14:03:22 |
合計ジャッジ時間 | 2,273 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 WA * 5 |
ソースコード
#include <bits/stdc++.h> #define REP(a,b,c) for(int a=b; a<(int)c; a++) #define rep(a,b) REP(a,0,b) #define REPR(a,b,c) for(int a=b; a>(int)c; a++) #define repr(a,b) REPR(a,b,0) #define pb(a) push_back(a) #define show(a) rep(iiixxxaaaa, a.size()) cout << a[i] << ", "; typedef long long int llint; using namespace std; int f(int n){ if(n==1) return 0; int rtn = f(n/2)^f((n+1)/2)^1; return n<3 ? rtn : (rtn | (f(n/3)^f((n+1)/3)^f((n+2)/3)^1)); } int main(){ int N; cin >> N; cout << (f(N)==1 ? "A" : "B") << endl; return 0; }