QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#239669#6558. Allergen TestingFyindRE 0ms3596kbC++20843b2023-11-04 22:21:002023-11-04 22:21:00

Judging History

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

  • [2023-11-04 22:21:00]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3596kb
  • [2023-11-04 22:21:00]
  • 提交

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;

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;
        for(int i=1;i<=n;i++){
            a[i]=a[i-1]*(d+1);
        }
        if(n==1){
            cout<<0<<endl;
            continue;
        }
        if(d>=n-1){
            cout<<1<<endl;
        }
        ll l=1,r=n;
        while(l<r){
            ll mid=(l+r)/2;
            if(a[mid]>=n){
                r=mid;
            }
            else l=mid+1;
        }
        cout<<l<<endl;
    }
}

详细

Test #1:

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

input:

1
4 1

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Runtime Error

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

result: