알고리즘 공부/백준 > Python3
[백준 파이썬] #2577: 숫자의 개수
IS_배키
2020. 11. 7. 01:42
https://www.acmicpc.net/problem/2577
2577번: 숫자의 개수
첫째 줄에 A, 둘째 줄에 B, 셋째 줄에 C가 주어진다. A, B, C는 모두 100보다 같거나 크고, 1,000보다 작은 자연수이다.
www.acmicpc.net
[정답]
A=int(input())
B=int(input())
C=int(input())
sum=list(str(A*B*C))
num_list=[0,0,0,0,0,0,0,0,0,0]
for i in sum:
num_list[int(i)]+=1
for i in range(len(num_list)):
print(num_list[i])
A=int(input())
B=int(input())
C=int(input())
sum=list(str(A*B*C))
print(sum)
A=150/B=266/C=427을 넣어서 실행시키면, 결과값이 ['1', '7', '0', '3', '7', '3', '0', '0'] 이렇게 나온다.
str(A*B*C)='17037300'인데 이를 list에 넣으면 ['1', '7', '0', '3', '7', '3', '0', '0']이렇게 하나하나 숫자가 분리되어 들어간다.