QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#239702#6558. Allergen TestingFyindWA 4ms3592kbC++20902b2023-11-04 22:33:482023-11-04 22:33:49

Judging History

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

  • [2023-11-04 22:33:49]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3592kb
  • [2023-11-04 22:33:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define _ <<" "<<
#define sz(x) ((int) (x).size())
typedef pair<int, int> pii;
typedef long long ll;
#define debug(x) cout<<#x<<':'<<x<<endl;
typedef unsigned long long ull;
const int maxn=1000;
ull ksm(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1) ans=a*ans;
        a=a*a;
        n>>=1;
    }
    return ans;
}

int main(){
    int T;
    cin>>T;
    while(T--){
        ll n,d;
        cin>>n>>d;
        //debug(n);debug(d);
        //vector<ll> a(n+1);
        //a[0]=1;
        if(n==1){
            cout<<0<<'\n';
            continue;
        } 
        if(d>=n-1){
            cout<<1<<'\n';
        }
        double sum=1;
        for(ll i=1;i<n;i++){
            if(sum*(d+1)>=n){
                cout<<i<<'\n';
                break;
            }
            sum*=(d+1);
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3560kb

input:

1
4 1

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 4ms
memory: 3592kb

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
60
0
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
3
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
4
4
4
5
4
4
4
4
4
4
4
5
4
4
4
4
4
4
4
5
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
6
5
5
5
5
5
5
5
5
5...

result:

wrong answer 5th lines differ - expected: '2', found: '1'