백준 c++ 11170 0의 개수
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의 개수를 세어줬따.
Author And Source
이 문제에 관하여(백준 c++ 11170 0의 개수), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@jaranda/백준-c-11170-0의-개수저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)