#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("16");
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
188 ms |
408 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
188 ms |
408 KB |
Output is correct |
2 |
Correct |
197 ms |
408 KB |
Output is correct |
3 |
Correct |
196 ms |
408 KB |
Output is correct |
4 |
Correct |
192 ms |
460 KB |
Output is correct |
5 |
Correct |
215 ms |
460 KB |
Output is correct |
6 |
Correct |
211 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
188 ms |
408 KB |
Output is correct |
2 |
Correct |
197 ms |
408 KB |
Output is correct |
3 |
Correct |
196 ms |
408 KB |
Output is correct |
4 |
Correct |
192 ms |
460 KB |
Output is correct |
5 |
Correct |
215 ms |
460 KB |
Output is correct |
6 |
Correct |
211 ms |
460 KB |
Output is correct |
7 |
Incorrect |
212 ms |
652 KB |
- |
8 |
Incorrect |
235 ms |
652 KB |
- |
9 |
Incorrect |
215 ms |
652 KB |
- |
10 |
Incorrect |
229 ms |
652 KB |
- |
11 |
Incorrect |
219 ms |
652 KB |
- |