#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;
}
int 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);
bool ok = 0;
for(int i=0; i<16; i++){
if(a + pw[z + i] > b){
printf("%d\n", i);
ok = 1;
break;
}
}
if(!ok) puts("9");
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
181 ms |
436 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
181 ms |
436 KB |
Output is correct |
2 |
Correct |
204 ms |
440 KB |
Output is correct |
3 |
Correct |
223 ms |
472 KB |
Output is correct |
4 |
Correct |
202 ms |
472 KB |
Output is correct |
5 |
Correct |
203 ms |
472 KB |
Output is correct |
6 |
Correct |
179 ms |
472 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
181 ms |
436 KB |
Output is correct |
2 |
Correct |
204 ms |
440 KB |
Output is correct |
3 |
Correct |
223 ms |
472 KB |
Output is correct |
4 |
Correct |
202 ms |
472 KB |
Output is correct |
5 |
Correct |
203 ms |
472 KB |
Output is correct |
6 |
Correct |
179 ms |
472 KB |
Output is correct |
7 |
Incorrect |
225 ms |
472 KB |
- |
8 |
Incorrect |
218 ms |
472 KB |
- |
9 |
Incorrect |
210 ms |
472 KB |
- |
10 |
Incorrect |
223 ms |
472 KB |
- |
11 |
Incorrect |
200 ms |
544 KB |
- |