QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304164#6558. Allergen TestingjackwasWA 1ms3616kbC++14659b2024-01-13 15:40:372024-01-13 15:40:38

Judging History

你现在查看的是最新测评结果

  • [2024-01-13 15:40:38]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3616kb
  • [2024-01-13 15:40:37]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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'