結果
| 問題 |
No.250 atetubouのzetubou
|
| コンテスト | |
| ユーザー |
not_522
|
| 提出日時 | 2015-08-04 11:34:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,211 bytes |
| コンパイル時間 | 1,472 ms |
| コンパイル使用メモリ | 164,464 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-18 01:12:38 |
| 合計ジャッジ時間 | 3,403 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 1 WA * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline T gcd(T a, T b) {
return __gcd(a, b);
}
template<typename T> inline T lcm(T a, T b) {
return a / gcd(a, b) * b;
}
template<typename T> inline T floor(T a, T b) {
return a / b * b <= a ? a / b : a / b - 1;
}
template<typename T> inline T ceil(T a, T b) {
return floor(a + b - 1, b);
}
template<typename T> inline T round(T a, T b) {
return floor(a + b / 2);
}
template<typename T> inline T mod(T a, T b) {
return a - floor(a, b) * b;
}
template<typename T> inline T factorial(T n) {
return n <= 1 ? 1 : factorial(n - 1) * n;
}
template<typename T> class Combination {
private:
vector<vector<T>> comb;
public:
Combination(int n = 0) : comb(n, vector<T>(n, 0)) {
for (int i = 0; i < n; ++i) comb[i][0] = 1;
for (int i = 1; i < n; ++i) {
for (int j = 1; j < n; ++j) {
comb[i][j] = comb[i - 1][j] + comb[i - 1][j - 1];
}
}
}
T combination(int n, int m) {
if (n < m) return 0;
if (n < (int)comb.size()) return comb[n][m];
T res = 1;
for (int i = 0; i < min(m, n - m); ++i) res = res * (n - i) / (i + 1);
return res;
}
T combination_safety(int n, int m) {
if (n < m) return 0;
if (n < (int)comb.size()) return comb[n][m];
m = min(m, n - m);
vector<int> a(m), b(m);
iota(a.begin(), a.end(), n - m + 1);
iota(b.begin(), b.end(), 1);
for (auto i : b) {
for (auto& j : a) {
auto g = gcd(i, j);
i /= g;
j /= g;
if (i == 1) break;
}
}
T res = 1;
for (auto i : a) res = res * i;
return res;
}
T repetition(int n, int r) {
return combination(n + r - 1, r);
}
};
int main() {
int q;
cin >> q;
Combination<long long> comb;
for (int i = 0; i < q; ++i) {
long long d, x, t;
cin >> d >> x >> t;
if (t == 0) {
cout << "ZETUBOU" << endl;
continue;
}
double sum = 0, limit = log(t);
for (int i = x + 1; i <= d + x - 1; ++i) sum += log(i + 1);
if (sum > limit * 2) {
cout << "ZETUBOU" << endl;
continue;
}
int s = comb.combination(d + x - 1, x);
cout << (s <= t ? "AC" : "ZETUBOU") << endl;
}
}
not_522