Skip to content

Commit d4691b9

Browse files
committed
[BOJ] #1475. 방 번호 / 실버5 / 구현 / 10분 / 성공
1 parent 28b873c commit d4691b9

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
# 0~9까지 숫자의 개수를 저장할 딕셔너리 초기화
5+
dict = { 0: 0, 1: 0, 2: 0, 3: 0, 4: 0,
6+
5: 0, 6: 0, 7: 0, 8: 0, 9: 0
7+
}
8+
9+
# 방 번호 입력
10+
room_nums = list(map(int, input().rstrip()))
11+
12+
# 숫자 개수 카운트
13+
for num in room_nums:
14+
if num == 6 or num == 9:
15+
if dict[6] <= dict[9]:
16+
dict[6] += 1
17+
else:
18+
dict[9] += 1
19+
else:
20+
dict[num] += 1
21+
22+
# 가장 많이 필요한 세트 개수 찾기
23+
answer = 0
24+
for value in dict.values():
25+
answer = max(answer, value)
26+
27+
print(answer)

0 commit comments

Comments
 (0)