Submission #70259045
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
const int N=105;
long long q,c,d;
signed main() {
cin>>q;
while(q--) {
int x;
cin>>c>>d;
long long ans=0;
long long num=floor(log(d+c)/log(10))+1,temp=c*pow(10,floor(log(c)/log(10))+1);
long long s=pow(10,floor(log(c)/log(10))+1);
long long l=ceil(sqrt(temp+c+1)),r=floor(sqrt(temp+min(d+c,s-1)));
ans+=max(r-l+1,0ll);
temp*=10;
for(int i=floor(log(c)/log(10))+2;i<=num;i++) {
s*=10;
l=ceil(sqrt(temp+pow(10,i-1)));
r=floor(sqrt(temp+min(d+c,s-1)));
ans+=max(r-l+1,0ll);
temp*=10;
}cout<<ans<<'\n';
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - 183184 |
| User | wallacewan |
| Language | C++ 20 (gcc 12.2) |
| Score | 0 |
| Code Size | 627 Byte |
| Status | WA |
| Exec Time | 478 ms |
| Memory | 3752 KiB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:11:21: warning: unused variable ‘x’ [-Wunused-variable]
11 | int x;
| ^
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 400 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-01.txt |
| All | 00-sample-01.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-01.txt | AC | 1 ms | 3688 KiB |
| 01-01.txt | AC | 473 ms | 3684 KiB |
| 01-02.txt | AC | 477 ms | 3728 KiB |
| 01-03.txt | AC | 469 ms | 3752 KiB |
| 01-04.txt | WA | 467 ms | 3676 KiB |
| 01-05.txt | AC | 478 ms | 3596 KiB |
| 01-06.txt | AC | 423 ms | 3752 KiB |
| 01-07.txt | WA | 450 ms | 3732 KiB |
| 01-08.txt | WA | 439 ms | 3752 KiB |
| 01-09.txt | WA | 478 ms | 3668 KiB |