結果

問題 No.250 atetubouのzetubou
ユーザー 184
提出日時 2015-07-24 23:07:36
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 615 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 34,652 KB
実行使用メモリ 71,912 KB
最終ジャッジ日時 2024-07-08 13:36:01
合計ジャッジ時間 1,468 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         int q,d,x;long long t;scanf("%d",&q);
      |                               ~~~~~^~~~~~~~~
main.cpp:16:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |                 scanf("%d%d%lld",&d,&x,&t);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <algorithm>
using namespace std;

//namaega184

long long nCk[3005][3005];
int main(){
	int q,d,x;long long t;scanf("%d",&q);
	nCk[0][0]=1;
	long long maxt=(long long)1e16;
	for(int i=1;i<=3000;i++){
		nCk[i][0]=nCk[i][i]=1;for(int j=1;j<i;j++){nCk[i][j]=nCk[i-1][j-1]+nCk[i-1][j];if(nCk[i][j]>=maxt)nCk[i][j]=maxt;}
	} 
	for(int i=0;i<q;i++){
		scanf("%d%d%lld",&d,&x,&t);
		x++;
		long long s=0;
		bool flag=0;
		if(d==1){s=1;if(s>t)flag=1;}
		for(int j=1;j<d;j++){
			s+=nCk[x+j-1][j];
			if(s>t){flag=1;break;}
		}
		if(flag)printf("ZETUBOU\n");
		else printf("AC\n");
	}
	return 0;
}
0