結果

問題 No.250 atetubouのzetubou
ユーザー 184
提出日時 2015-07-24 23:04:18
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 35,040 KB
実行使用メモリ 19,196 KB
最終ジャッジ日時 2024-07-08 13:32:30
合計ジャッジ時間 1,044 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other WA * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
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[1505][1505];
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<=1500;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];
			if(s>t){flag=1;break;}
		}
		if(flag)printf("ZETUBOU\n");
		else printf("AC\n");
	}
	return 0;
}
0