2577: 숫자의 개수

Jimin·2022년 11월 30일
0

알고리즘

목록 보기
30/71

https://www.acmicpc.net/problem/2577

#include <iostream>
#include <string>

using namespace std;


int main(){
    int a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;
    int total;
    total = a*b*c;
    int cnt[9] = {0};
    int zcnt=0;
    while(total>0) {
        int e = total % 10;
        if(e == 0) zcnt++;
        for(int i=1;i<10;i++) {
            if(i == e) {
                cnt[i-1]++;
            }
        }
        total /= 10;
    }
    cout << zcnt << endl;
    for(int i=0;i<9;i++){
        cout << cnt[i] << endl;
    }
    return 0;
}
profile
https://github.com/Dingadung

0개의 댓글