結果

問題 No.250 atetubouのzetubou
ユーザー nasadigital
提出日時 2015-07-24 23:46:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 815 bytes
コンパイル時間 487 ms
コンパイル使用メモリ 64,452 KB
実行使用メモリ 21,380 KB
最終ジャッジ日時 2024-07-16 00:28:56
合計ジャッジ時間 1,685 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
#include <utility>
#include <algorithm>
#include <vector>
#include <cstring>

#define _P(x) printf(x)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;

ll comb[1503][1503];

ll rek(int d,int x){
if(d<0 || x<0)
return 0;
if(d==0 && x==0)
	return 1;
if(comb[d][x]==-1){
comb[d][x]=rek(d-1,x)+rek(d,x-1);
if(comb[d][x]>1e15+2)
comb[d][x]=1e15+2;
}
return comb[d][x];
}


int main(){
ios::sync_with_stdio(false);
memset(comb,-1,sizeof(comb));
int q;
cin>>q;
while(q--){
ll d,x,t;
cin>>d>>x>>t;
//cout<<"REZ HERE IS:"<<rek(d-1,x)<<endl;
if(rek(d-1,x)<=t) _P("AC\n");
else _P("ZETUBOU\n");
}
return 0;
}
0