Submission #66238

#TimeUsernameProblemLanguageResultExecution timeMemory
66238gs14004채점 시스템 (OJUZ11_judge)C++17
100 / 100
291 ms14096 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...