QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#304164 | #6558. Allergen Testing | jackwas | WA | 1ms | 3616kb | C++14 | 659b | 2024-01-13 15:40:37 | 2024-01-13 15:40:38 |
Judging History
answer
#include <iostream>
#include <math.h>
typedef long long ll;
using namespace std;
ll fact[21];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
fact[0] = 1;
for (int i = 1; i < 21; i++) {
fact[i] = fact[i-1] * i;
}
int t;
cin >> t;
while(t--) {
ll n, d;
cin >> n >> d;
d++;
int e = 1;
while (e < 21) {
ll cur = fact[e];
if (e >= d) cur /= fact[e - d];
// cout << e << ' ' << cur << endl;
if (cur >= n) break;
e++;
}
cout << e - 1 << endl;
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3392kb
input:
1 4 1
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3616kb
input:
10000 1 1 1000000000000000000 1 1 1000000000000000000 1000000000000000000 1000000000000000000 26615519354743225 163142634 26615519354743225 163142634 26615519354743224 163142634 26615519354743226 163142634 847997831064072529 920867976 847997831064072529 920867976 847997831064072528 920867976 8479978...
output:
0 20 0 19 18 18 18 18 19 19 19 19 19 19 19 19 18 18 18 18 19 19 19 19 19 19 19 19 18 18 18 18 17 17 17 17 19 19 19 19 18 18 18 18 19 19 19 19 19 19 19 19 19 19 19 19 18 18 18 18 18 18 18 18 19 19 19 19 19 19 19 19 18 18 18 18 19 19 19 19 19 19 19 19 18 18 18 18 19 19 19 19 18 18 18 18 17 17 17 17 18...
result:
wrong answer 2nd lines differ - expected: '60', found: '20'