QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#411162#6558. Allergen TestingDanielChangWA 2ms3560kbC++171.2kb2024-05-15 02:43:362024-05-15 02:43:37

Judging History

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

  • [2024-05-15 02:43:37]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3560kb
  • [2024-05-15 02:43:36]
  • 提交

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'