QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#413039 | #6558. Allergen Testing | Lspeed# | WA | 3ms | 3916kb | C++20 | 1.6kb | 2024-05-17 00:43:09 | 2024-05-17 00:43:10 |
Judging History
answer
#include<bits/stdc++.h>
#define x first
#define y second
#define eb emplace_back
#define pb push_back
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define ROF(i,a,b) for(int i=(a);i>=(b);--i)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define sz(x) (int)(x).size()
#define make_unique(x) sort(all(x)), (x).erase(unique(all(x)), (x).end())
using namespace std;
typedef long long i64;
//typedef __int128 i128;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<i64> vl;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<i64,i64> pll;
typedef tuple<int,int,int> iii;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
int readInt() { int a; scanf("%d",&a); return a; }
i64 readLong() { i64 a; scanf("%lld",&a); return a; }
char readChar() { char a; scanf(" %c",&a); return a; }
double readDouble() { double a; scanf(" %lf",&a); return a; }
void readString(char *s) { scanf(" %s",s); }
const int mod = 998244353;
int add(int a, int b) { return ((a+=b)>=mod) ? a-mod:a; }
int mul(int a, int b) { return a*1ll*b%mod; }
int pw(int a, int b) {
int ans = 1, res = a;
for(int i = 1; i <= b; i*=2, res=mul(res,res)) {
if(i&b) {
ans = mul(ans, res);
}
}
return ans;
}
typedef long long ll;
void solve() {
ll n, d;
scanf(" %lld %lld",&n,&d);
ll val = 1;
FOR(i,1,60) {
if (val <= n/(d+1)) {
val *= (d+1);
} else {
printf("%d\n",i);
return ;
}
if(val == n) {
printf("%d\n",i);
return ;
}
}
}
int main() {
int t= readInt();
while(t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3916kb
input:
1 4 1
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 3ms
memory: 3748kb
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:
1 60 1 1 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 3 3 3 3 4 3 3 3 4 3 3 3 4 3 3 3 4 3 3 3 4 3 3 3 4 3 3 3 4 3 3 3 4 3 3 3 4 3 3 3 4 4 4 4 5 4 4 4 5 4 4 4 5 4 4 4 5 4 4 4 5 4 4 4 5 4 4 4 5 4 4 4 5 4 4 4 5 4 4 4 5 5 5 5 6 5 5 5 6 5 5 5 6 5 5 5 6 5 5 5 6 5 5 5 6 5 5...
result:
wrong answer 1st lines differ - expected: '0', found: '1'