結果

問題 No.250 atetubouのzetubou
ユーザー masamasa
提出日時 2015-09-23 19:09:21
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 23 ms / 5,000 ms
コード長 684 bytes
コンパイル時間 445 ms
コンパイル使用メモリ 61,792 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-26 14:37:28
合計ジャッジ時間 1,795 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
4,376 KB
testcase_01 AC 4 ms
4,380 KB
testcase_02 AC 20 ms
4,380 KB
testcase_03 AC 23 ms
4,376 KB
testcase_04 AC 20 ms
4,384 KB
testcase_05 AC 21 ms
4,376 KB
testcase_06 AC 16 ms
4,376 KB
testcase_07 AC 9 ms
4,376 KB
testcase_08 AC 19 ms
4,376 KB
testcase_09 AC 15 ms
4,376 KB
testcase_10 AC 20 ms
4,380 KB
testcase_11 AC 13 ms
4,376 KB
testcase_12 AC 19 ms
4,376 KB
testcase_13 AC 11 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 21 ms
4,376 KB
testcase_16 AC 21 ms
4,500 KB
testcase_17 AC 22 ms
4,376 KB
testcase_18 AC 22 ms
4,376 KB
testcase_19 AC 22 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

const long long INF = 1e15 + 1;

long long combination(int n, int r) {
    r = min(r, n - r);
    long long val = 1;
    for (int i = 1; i <= r; i++) {
        val *= n + 1 - i;
        val /= i;

        if (val >= INF) {
            return INF;
        }
    }

    return val;
}

int main() {
    int q, d, x;
    long long t;

    cin >> q;
    vector<bool> ok(q);
    for (int i = 0; i < q; i++) {
        cin >> d >> x >> t;
        d--;
        ok[i] = (combination(d + x, x) <= t);
    }

    for (int i = 0; i < q; i++) {
        cout << (ok[i] ? "AC" : "ZETUBOU") << endl;
    }
    return 0;
}
0