#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
int get_jarisoo(int x){
if(x == 0) return 1;
int ans = 0;
while(x){
ans++;
x /= 10;
}
return ans;
}
lint pw[18];
int main(){
pw[0] = 1;
for(int i=1; i<18; i++) pw[i] = pw[i-1] * 10;
int q;
cin >> q;
while(q--){
int a, b;
cin >> a >> b;
int z = get_jarisoo(a);
for(int i=0; i<16; i++){
if(a + pw[z + i] > b){
printf("%d\n", i);
break;
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
175 ms |
324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
175 ms |
324 KB |
Output is correct |
2 |
Correct |
200 ms |
384 KB |
Output is correct |
3 |
Correct |
203 ms |
452 KB |
Output is correct |
4 |
Correct |
224 ms |
452 KB |
Output is correct |
5 |
Correct |
202 ms |
512 KB |
Output is correct |
6 |
Correct |
207 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
175 ms |
324 KB |
Output is correct |
2 |
Correct |
200 ms |
384 KB |
Output is correct |
3 |
Correct |
203 ms |
452 KB |
Output is correct |
4 |
Correct |
224 ms |
452 KB |
Output is correct |
5 |
Correct |
202 ms |
512 KB |
Output is correct |
6 |
Correct |
207 ms |
512 KB |
Output is correct |
7 |
Correct |
219 ms |
516 KB |
Output is correct |
8 |
Correct |
212 ms |
516 KB |
Output is correct |
9 |
Correct |
216 ms |
516 KB |
Output is correct |
10 |
Correct |
215 ms |
516 KB |
Output is correct |
11 |
Correct |
226 ms |
516 KB |
Output is correct |