백준 16462번: '나교수' 교수님의 악필 #Python

ColorlessDia·2024년 2월 24일

algorithm/baekjoon

목록 보기
95/836
import sys
import math

N = int(input())

total_score = 0

for _ in range(N):
    score = sys.stdin.readline().rstrip()

    formatted_score = ''

    for number in score:
        if number in ['0', '6', '9']:
            formatted_score += '9'
        else:
            formatted_score += number
    
    if 100 < int(formatted_score):
        formatted_score = 100
    else:
        formatted_score = int(formatted_score)
    
    total_score += formatted_score

average_score = total_score / N

if average_score - int(average_score) < 0.5:
    print(math.floor(average_score))
else:
    print(math.ceil(average_score))

0개의 댓글