티스토리 뷰

https://www.acmicpc.net/problem/1475

 

1475번: 방 번호

첫째 줄에 다솜이의 방 번호 N이 주어진다. N은 1,000,000보다 작거나 같은 자연수 또는 0이다.

www.acmicpc.net

import sys

N = str(sys.stdin.readline())
N = N.replace('9', '6')

res = 0

for i in range(9):
    cnt = N.count(str(i))
    
    if i == 6:
        cnt = (cnt // 2 + cnt % 2)

    if res < cnt:
        res = cnt
        
print(res)
공지사항
최근에 올라온 글
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함