⌨️ Algorithms/백준
[Python] 백준 2577번_숫자의 개수
monzheld
2022. 7. 11. 21:56
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())
N = A*B*C
result = list(str(N)) # N을 문자열로 변환해 리스트에 저장
for i in range(10): # 0~9
print(result.count(str(i))) # result에 있는 문자열 i 의 개수를 카운트
-> list.count(x) 사용
https://dev-note-97.tistory.com/17
[Python] 파이썬 배열 원소 세는 방법 count() / collections.Counter()
👀 배열 원소 수 세는 방법 ( count() / collections.Counter() ) 👀 1.list.count(x) : 배열 내 주어진 원소 x의 갯수를 셉니다. x가 포함된 원소가 아닌, x 자체만 셈. 문자열 가능 2.collections.Counter(배..
dev-note-97.tistory.com