結果
問題 | No.153 石の山 |
ユーザー |
|
提出日時 | 2020-06-07 15:20:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 454 bytes |
コンパイル時間 | 2,655 ms |
コンパイル使用メモリ | 197,152 KB |
最終ジャッジ日時 | 2025-01-10 23:52:51 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | int n; scanf("%d",&n); | ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0;i<(n);i++)using namespace std;int main(){int n; scanf("%d",&n);int gr[101]={-1,0,1};for(int x=3;x<=n;x++){set<int> S;if(x%2==0) S.emplace(gr[x/2]^gr[x/2]);if(x%2==1) S.emplace(gr[x/2]^gr[x/2+1]);if(x%3==0) S.emplace(gr[x/3]);if(x%3==1) S.emplace(gr[x/3+1]);if(x%3==2) S.emplace(gr[x/3]);for(gr[x]=0;S.count(gr[x])>0;gr[x]++);}puts(gr[n]>0?"A":"B");return 0;}