結果

問題 No.250 atetubouのzetubou
ユーザー h_noson
提出日時 2016-02-19 16:19:30
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2,927 ms / 5,000 ms
コード長 891 bytes
コンパイル時間 670 ms
コンパイル使用メモリ 73,132 KB
実行使用メモリ 144,000 KB
最終ジャッジ日時 2024-09-22 12:19:17
合計ジャッジ時間 42,558 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

#define RREP(i,s,e) for (i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e8

map<pair<int,int>,long long> comb;

long long combination(int n, int k) {
    pair<int,int> p {n,k};
    if (n == k || k == 0)
        return 1;
    else if (comb.count(p) > 0)
        return comb[p];
    else {
        long long ret = min(1000000000000001LL,combination(n-1,k) + combination(n-1,k-1));
        comb[p] = ret;
        return ret;
    }
}

int main() {
    int i, j, q;
    cin >> q;
    rep (i,q) {
        int d,x;
        long long t;
        cin >> d >> x >> t;
        if (combination(x+d-1,d-1) <= t)
            cout << "AC" << endl;
        else
            cout << "ZETUBOU" << endl;
    }
    return 0;
}
0