結果
問題 | No.153 石の山 |
ユーザー |
|
提出日時 | 2017-08-09 18:04:53 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 558 bytes |
コンパイル時間 | 1,295 ms |
コンパイル使用メモリ | 163,324 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 03:57:41 |
合計ジャッジ時間 | 2,433 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:28:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | scanf("%d",&n); | ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h>#define MOD 1000000007LLusing namespace std;typedef long long ll;typedef pair<int,int> P;int dp[101];int solve(int v){if(dp[v]!=-1)return dp[v];set<int> si;si.insert(solve(v/2)^solve((v+1)/2));si.insert(solve(v/3)^solve((v+1)/3)^solve((v+2)/3));int res=0;for(set<int>::iterator it=si.begin();it!=si.end();it++){if((*it)!=res)break;res++;}dp[v]=res;return res;}int main(void){int n;memset(dp,-1,sizeof(dp));dp[1]=0;dp[2]=1;scanf("%d",&n);printf("%s\n",(solve(n)!=0)?"A":"B");return 0;}