728x90
반응형
11170 0의 개수
문제풀이
#include <iostream>
#include <string>
using namespace std;
void fast_io(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main()
{
fast_io();
int t;
cin >> t;
while (t--)
{
int n, m, cnt = 0;
cin >> n >> m;
for (int i = n; i <= m; i++)
{
string str = to_string(i);
for (int j = 0; j < str.length(); j++)
{
if (str[j] == '0')
cnt++;
}
}
cout << cnt << "\n";
}
}
0의 개수를 세어줬따.
728x90
반응형
'자라는 개발자 > 문제풀이' 카테고리의 다른 글
백준 c++ 11586 지영공주님의 마법 거울 (0) | 2022.02.22 |
---|---|
백준 c++ 11656 접미사 배열 (0) | 2022.02.18 |
백준 c++ 15235 Olympiad Pizza (0) | 2022.02.10 |
백준 c++ 15832 Aku Negaraku (0) | 2022.02.09 |
백준 c++ 14783 Eenie Meenie Miney Moe (0) | 2022.02.08 |