QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#211329 | #6558. Allergen Testing | jiangtaizhe001 | TL | 0ms | 3732kb | C++14 | 1.3kb | 2023-10-12 15:02:40 | 2023-10-12 15:02:41 |
Judging History
answer
#include<cstdio>
#include<iostream>
#define db double
#define pc putchar
#define ll long long
#define Tp template<typename _T>
Tp _T mabs(_T a){ return a<0?-a:a; }
Tp _T mmax(_T a,_T b){ return a<b?b:a; }
Tp _T mmin(_T a,_T b){ return a<b?a:b; }
Tp void mswap(_T &a,_T &b){ _T t=a; a=b; b=t; return; }
using namespace std;
struct IO{
char buf[1<<21],*p1,*p2;
char gc(){ return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++; }
IO & operator >> (char &x){ x=gc(); while(x=='\r'||x=='\n'||x==' ') x=gc(); return *this; }
Tp IO & operator >> (_T &x){
x=0; char c=gc(); bool f=0; while(c<'0'||c>'9'){ if(c=='-') f^=1; c=gc(); }
while('0'<=c&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=gc(); f?x=-x:0; return *this;
}
int st[39],top;
IO & operator << (char x) { pc(x); return *this; }
Tp IO & operator << (_T x){
if(x<0) x=-x,pc('-'); if(x==0){ pc('0'); return *this; }
top=0; while(x) st[++top]=x%10,x/=10;
while(top--) pc(st[top+1]+48); return *this;
}
}fin;
#define maxn
ll n,m,t;
void work(){
fin>>n>>m; if(n==1){ fin<<0<<'\n'; } int i; t=1; m++;
for(i=1;;i++){
t*=m;
if(t>=n){ fin<<i<<'\n'; return; }
}
}
int main(){
#ifdef LOCAL
freopen("1.in","r",stdin);
//freopen(".out","w",stdout);
#endif
int T; fin>>T; while(T--) work(); return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3732kb
input:
1 4 1
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Time Limit Exceeded
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...