結果

問題 No.250 atetubouのzetubou
ユーザー hanorverhanorver
提出日時 2015-09-25 09:10:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 607 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 58,824 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-26 15:01:54
合計ジャッジ時間 1,705 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<algorithm>

const long long INF = 1e15 + 1;

long long combination(int n, int r) {
	r = std::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 query_num;
	std::cin >> query_num;

	for (int i = 0; i < query_num; i++) {
		long long loop, value, limit;
		std::cin >> loop >> value >> limit;
		loop--;
		if (combination(loop + value, value) > limit) {
			std::cout << "ZETUBOU" << std::endl;
		} else {
			std::cout << "AC" << std::endl;
		}
	}
	return 0;
}
0