結果

問題 No.153 石の山
ユーザー ttkkggww
提出日時 2022-08-17 17:12:16
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 607 bytes
コンパイル時間 4,343 ms
コンパイル使用メモリ 254,560 KB
最終ジャッジ日時 2025-01-30 23:31:03
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
int n;
int ans[202];

void solve(){
	ans[1] = 0;
	ans[2] = 1;
	for(int i = 3;i<202;i++){
		int l = 0;
		for(int k = 0;k<2;k++){
			l ^= ans[i/2+(i%2>k?1:0)];
		}
		set<int> st;
		st.insert(l);
		l= 0;
		for(int k = 0;k<3;k++){
			l ^= ans[i/3+(i%3>k?1:0)];
		}
		st.insert(l);
		for(int j = 0;;j++){
			if(st.count(j));
			else{
				ans[i] = j;
				break;
			}
		}
	}
	cout<<(char)('B'-!!ans[n])<<endl;
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> n;
	solve();
}
0