Submission #20357

# Submission time Handle Problem Language Result Execution time Memory
20357 2017-02-07T07:58:18 Z 채점 시스템 (OJUZ11_judge) C++
100 / 100
218 ms 608 KB
#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);
		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");
	}
}
# Verdict Execution time Memory Grader output
1 Correct 199 ms 388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 199 ms 388 KB Output is correct
2 Correct 211 ms 440 KB Output is correct
3 Correct 213 ms 472 KB Output is correct
4 Correct 202 ms 540 KB Output is correct
5 Correct 203 ms 540 KB Output is correct
6 Correct 193 ms 544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 199 ms 388 KB Output is correct
2 Correct 211 ms 440 KB Output is correct
3 Correct 213 ms 472 KB Output is correct
4 Correct 202 ms 540 KB Output is correct
5 Correct 203 ms 540 KB Output is correct
6 Correct 193 ms 544 KB Output is correct
7 Correct 210 ms 544 KB Output is correct
8 Correct 215 ms 544 KB Output is correct
9 Correct 204 ms 544 KB Output is correct
10 Correct 217 ms 544 KB Output is correct
11 Correct 218 ms 608 KB Output is correct