結果

問題 No.153 石の山
ユーザー たこしたこし
提出日時 2015-06-09 23:32:35
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,264 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 98,184 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-22 14:59:31
合計ジャッジ時間 1,611 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
5,376 KB
testcase_11 WA -
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 0 ms
5,376 KB
testcase_15 WA -
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 1 ms
5,376 KB
testcase_22 WA -
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 WA -
testcase_28 AC 1 ms
5,376 KB
testcase_29 WA -
testcase_30 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>
#include <complex>

#define INF_MIN 100000000
#define INF 1145141919
#define INF_MAX 2147483647
#define LL_MAX 9223372036854775807
#define EPS 1e-10
#define PI acos(-1)
#define LL long long

using namespace std;

#define MAX_N 101

int N;
int grundy[MAX_N];

void init(){

  for(int i = 2; i <= N; i++){
    set<int> S;
    if(i >= 2){
      if(i % 2 == 0){
	S.insert(grundy[i/2]);
      }
      else{
	S.insert(grundy[i/2]);
	S.insert(grundy[i/2 + 1]);
      }
    }
    if(i >= 3){
      if(i % 3 == 0){
	S.insert(grundy[i/3]);
      }
      else{
	S.insert(grundy[i/3]);
	S.insert(grundy[i/3 + 1]);
      }
    }
    for(int n = 0; ; n++){
      if(S.find(n) == S.end()){
	grundy[i] = n;
	break;
      }
    }
  }

}

int main(){

  cin >> N;

  init();

  if(grundy[N])
    cout << "A" << endl;
  else
    cout << "B" << endl;

  return 0;

}
0