結果

問題 No.153 石の山
ユーザー ふーらくたるふーらくたる
提出日時 2018-01-05 14:59:39
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 815 ms
コンパイル使用メモリ 59,980 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-24 20:18:23
合計ジャッジ時間 1,972 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <set>
using namespace std;

int g[110];

int main() {
    int N;
    cin >> N;

    g[2] = 1;
    for (int x = 3; x <= N; x++) {
        set<int> s;
        if (x % 2 == 0) s.insert(g[x / 2] ^ g[x / 2]);
        else s.insert(g[x / 2] ^ g[x / 2 + 1]);

        if (x % 3 == 0) s.insert(g[x / 3] ^ g[x / 3] ^ g[x ^ 3]);
        else if (x % 3 == 1) s.insert(g[x / 3] ^ g[x / 3] ^ g[x / 3 + 1]);
        else s.insert(g[x / 3] ^ g[x / 3 + 1] ^ g[x / 3 + 1]);

        int num = 0;
        for (int n : s) {
            if (num != n) break;
            num++;
        }
        g[x] = num;
    }

    if (g[N]) cout << "A" << endl;
    else cout << "B" << endl;
    
    return 0;
}
0