python-algorithm

[백준] 16462

무적김두칠 2021. 1. 18. 13:52

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import math
cnt=0
n=int(input())
for _ in range(n):
    tmp=input()
    if tmp=='100' : cnt+=100
    else:
        tmpnew = ''
        for i in range(len(tmp)):
 
            if tmp[i] == '6' : tmpnew+='9'
            elif tmp[i] == '0' : tmpnew+='9'
            else: tmpnew+=tmp[i]
        cnt+=int(tmpnew)
ans=cnt/n
if ans- int(ans) >=0.5 : print(math.ceil(ans))
elseprint(math.floor(ans))
cs

6이랑 0을 9로 바꾼다 이게 말은 쉬운데요

반응형