-Code
from math import ceil, floor
nums = []
student = int(input())
for _ in range(student):
n = input()
num = ""
for i in n:
if i == '0' or i == '6':
num += '9'
continue
num += i
num = int(num)
if num > 100:
num = 100
nums.append(num)
res = sum(nums) / student
print(ceil(res) if res - int(res) >= 0.5 else floor(res))
반올림에 문제가 있어서 다른 방법으로 해결을 했습니다.
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 19946번 2의 제곱수 계산하기 (0) | 2022.07.13 |
---|---|
[백준/파이썬] 17466번 N! mod P (1) (0) | 2022.07.12 |
[백준/파이썬] 17946번 피자는 나눌 수록 커지잖아요 (0) | 2022.07.10 |
[백준/파이썬] 17206번 준석이의 수학 숙제 (0) | 2022.07.09 |
[백준/파이썬] 14710번 고장난 시계 (0) | 2022.07.08 |