結果

問題 No.153 石の山
ユーザー sugim48sugim48
提出日時 2015-02-15 23:32:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,464 bytes
コンパイル時間 677 ms
コンパイル使用メモリ 84,140 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 15:11:06
合計ジャッジ時間 1,596 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v, w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int INF = INT_MAX / 2;

char c[100001];

vector<int> manachar(string& S) {
	vector<int> R(S.length());
	int i = 0, j = 0;
	while (i < S.size()) {
		while(i-j >= 0 && i+j < S.size() && S[i-j] == S[i+j]) ++j;
		R[i] = j;
		int k = 1;
		while(i-k >= 0 && i+k < S.size() && k+R[i-k] < j) R[i+k] = R[i-k], ++k;
		i += k; j -= k;
	}
	return R;
}

int main() {
	vector<int> a(101);
	a[1] = 0;
	for (int i = 2; i <= 100; i++) {
		vector<bool> b(6);
		if (i % 2 == 0) b[a[i / 2] ^ a[i / 2]] = true;
		if (i % 2 == 1) b[a[i / 2] ^ a[i / 2 + 1]] = true;
		if (i % 3 == 0) b[a[i / 3] ^ a[i / 3] ^ a[i / 3]] = true;
		if (i % 3 == 1) b[a[i / 3] ^ a[i / 3] ^ a[i / 3 + 1]] = true;
		if (i % 3 == 2) b[a[i / 3] ^ a[i / 3 + 1] ^ a[i / 3 + 1]] = true;
		for (int& j = a[i]; b[j]; j++);
	}
	int N; cin >> N;
	cout << (a[N] ? 'A' : 'B') << endl;
}
0