코딩/C++

BOJ 2577 숫자의 개수 (C++)

구운계란 2021. 8. 1. 19:56
#include <bits/stdc++.h>
using namespace std;

int main() {
    int x,y,z;
    cin >> x >> y >> z;
    int t=x*y*z,ans[10]={0,0,0,0,0,0,0,0,0,0};
    while(t!=0) {
        ans[t-(t/10)*10]++;
        t/=10;
    }
    for (int i=0;i<10;i++) cout << ans[i] << endl;
    return 0;
}

'코딩 > C++' 카테고리의 다른 글

BOJ 11720 숫자의합 (C++)  (0) 2021.07.31
BOJ 1110 더하기 사이클 (C++)  (0) 2021.07.31