1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <stdio.h>
int main()
{
int A, B, C, Result =0;
int count[10] = {0};
scanf("%d\n%d\n%d\n", &A, &B, &C);
Result = A*B*C;
while(Result > 0){
int num = Result % 10;
Result /= 10;
count[num]++;
}
for(int i = 0; i < 10; i++){
printf("%d\n", count[i]);
}
return 0;
}
|
|
포인트는 각 숫자들을 곱한 값이 몇 자리 수일지 모르기에
몇 자리이던 상관없이 계산 가능하도록 %를 이용해 각 자리를 구하며 즉시 배열에 값으로 때려넣는 것,,!
'스터디 > 알고리즘' 카테고리의 다른 글
C++ 백준 8958 - OX퀴즈 (0) | 2019.11.17 |
---|---|
C++ 백준 1546 - 평균 (0) | 2019.11.17 |
C++ 백준 10951 - A+B - 4 (0) | 2019.11.14 |
C++ 백준 2884 - 알람시계 (0) | 2019.09.09 |
C++ 백준 2753 - 윤년 (0) | 2019.09.09 |