QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#411162 | #6558. Allergen Testing | DanielChang | WA | 2ms | 3560kb | C++17 | 1.2kb | 2024-05-15 02:43:36 | 2024-05-15 02:43:37 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll __int128
#define endl '\n'
__int128 read() {
__int128 x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
return x * f;
}
void print(__int128 x) {
if (x < 0) {
putchar('-');
x = -x;
}
if (x > 9) print(x / 10);
putchar(x % 10 + '0');
}
bool cmp(__int128 x, __int128 y) { return x > y; }
int main(){
ios::sync_with_stdio(false); cin.tie(0);
ll t;
t = read();
while(t--){
ll n, d;
n = read();
d = read();
ll a=1;
for(ll i=0; ; i++){
if(i) a *= 2;
ll p = d;
ll res = 1;
bool ok = 0;
while(p && !ok){
if(p & 1){
res = res * a;
if(res >= n) ok = 1;
}
p /= 2;
if(!p) continue;
a = a * a;
if(a >= n) ok = 1;
}
if(ok){
print(i);
putchar('\n');
break;
}
}
}
}
詳細信息
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: 2ms
memory: 3552kb
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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
result:
wrong answer 5th lines differ - expected: '2', found: '1'