結果
問題 | No.153 石の山 |
ユーザー |
![]() |
提出日時 | 2015-08-08 06:30:15 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,247 bytes |
コンパイル時間 | 613 ms |
コンパイル使用メモリ | 84,804 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-14 14:39:16 |
合計ジャッジ時間 | 1,662 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
#define _USE_MATH_DEFINES#include <iostream>#include <iomanip>#include <sstream>#include <algorithm>#include <cmath>#include <string>//#include <array>#include <list>#include <queue>#include <vector>#include <complex>#include <set>#include <map>/////////#define REP(i, x, n) for(int i = x; i < n; i++)#define rep(i,n) REP(i,0,n)#define P(p) cout<<(p)<<endl;#define PII pair<int,int>/////////typedef long long LL;typedef long double LD;/////////using namespace::std;/////////int main(void){std::cin.tie(0);std::ios::sync_with_stdio(false);std::cout << std::fixed;////cout << setprecision(16);//int N;cin>>N;int dp[101];rep(i,100){dp[i] = -1;}dp[1] = 0;dp[2] = 1;int temp3,temp2;for(int i=3;i<=N;++i){{temp3 = 0;rep(j,i%3){temp3 ^= dp[i/3+1];}rep(j,3-i%3){temp3 ^= dp[i/3];}}{temp2 = 0;temp2 ^= dp[i/2+i%2];temp2 ^= dp[i/2];}int s,b;s = min(temp2,temp3);b = max(temp2,temp3);if( s == b ){if(s==0){dp[i] = 1;}else{dp[i] = 0;}}else if(s > 0){dp[i] = 0;}else if(b > 1){dp[i] = 1;}else{dp[i] = 2;}}if( dp[N] != 0){P("A");}else{P("B");}return 0;}