QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#410641#6558. Allergen TestingDanielChang#WA 1ms3884kbC++171.2kb2024-05-14 10:43:322024-05-14 10:43:33

Judging History

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

  • [2024-05-14 10:43:33]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3884kb
  • [2024-05-14 10:43:32]
  • 提交

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=1; ; 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: 3576kb

input:

1
4 1

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3884kb

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
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 1st lines differ - expected: '0', found: '1'