카테고리 없음

[백준 11170번 / C++ / Silver V] 0의 개수

배발자 2022. 1. 16.
반응형
#include <iostream>
using namespace std; 
int main() {
	int n; cin >> n; 
	while (n--) {
		int cnt = 0; 
		int a, b; cin >> a >> b; 
		
		while (a <= b) {
			int x = a;
			if (x == 0)cnt++;
			else if (x >= 10) {
				while (x / 10 != 0) {
					if (x % 10 == 0)cnt++;
					x /= 10;
				}
			

			}
			a++;

		}
		cout << cnt<<"\n"; 
	}
}
반응형

댓글