- python
a=int(input()); b=int(input()); c=int(input())
mul = str(a*b*c)
for i in range(10) :
print(mul.count(str(i)))
- C++
#include <iostream>
#include <string>
#include <string.h>
using namespace std;
int main() {
int a, b, c;
int mul = 0;
string str;
int count[10] = {};
cin >> a >> b >> c;
mul = a * b * c;
string s = to_string(mul); // int to string
// s 순회하며 해당 인덱스 값 +1
for (char ch : s) {
count[ch-'0']++; // **아스키코드 0값 빼주기**
}
for (int i : count) {
cout << i << endl;
}
}
'자기개발👨💻 > 코딩 알고리즘' 카테고리의 다른 글
[python, C++] 백준 2953 나는 요리사다 (0) | 2022.02.03 |
---|---|
[python, C++] 백준 2711 오타맨 고창영 (0) | 2022.02.03 |
[python, C++] 백준 2592 대표값 (0) | 2022.01.30 |
[python, c++] 백준 2460 지능형 기차2 (0) | 2022.01.29 |
[c++] 백준 2908 상수 (0) | 2022.01.24 |
[python] 백준 1051 숫자 정사각형 (0) | 2022.01.04 |