문제
https://www.acmicpc.net/problem/1475
1475번: 방 번호
첫째 줄에 다솜이의 방 번호 N이 주어진다. N은 1,000,000보다 작거나 같은 자연수이다.
www.acmicpc.net
결과

풀이
import math
n = int(input())
set = {}
for i in range(0, 10):
set[i] = 0
for i in str(n):
set[int(i)] += 1
set[6] = math.ceil((set[6] + set[9]) / 2)
set[9] = 0
print(max(set.values()))
'알고리즘 > 구현' 카테고리의 다른 글
| [프로그래머스][js] 주차 요금 계산 (0) | 2024.07.06 |
|---|---|
| [백준][js] 20436_ZOAC 3 (0) | 2024.06.23 |
| [백준][python] 1021 회전하는 큐 (0) | 2022.03.10 |
| [백준][python] 1316 그룹 단어 체커 (0) | 2022.02.19 |
| [백준][python] 4673 셀프 넘버 (0) | 2022.02.17 |