2577번: 숫자의 개수
첫째 줄에 A, 둘째 줄에 B, 셋째 줄에 C가 주어진다. A, B, C는 모두 100보다 같거나 크고, 1,000보다 작은 자연수이다.
www.acmicpc.net
#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int a, b, c; cin >> a >> b >> c;
int res = a * b * c;
int his[10] = {};
int digit = 0;
while (res > 0) {
digit = res % 10;
res /= 10;
his[digit] +=1;
}
for (int& n : his) { cout << n << endl; }
return 0;
}
'Problem set' 카테고리의 다른 글
[백준] 2884: 알람 시계 (0) | 2020.12.29 |
---|---|
[백준] 2588: 곱셈 (0) | 2020.12.29 |
[백준] 2089: -2진수 (0) | 2020.12.29 |
[백준] 1978: 소수 찾기 (0) | 2020.12.29 |
[백준] 1934: 최소공배수 (0) | 2020.12.29 |