[BOJ]1546:平均値



🔒 例

>> 3
>> 40 80 60

75.0

>> 3
>> 10 20 30

66.666667

>> 4
>> 1 100 100 100

75.25

>> 5
>> 1 2 4 8 16

38.75

>> 2
>> 3 10

65.0

🔧 に答える

1. n = int(sys.stdin.readline().rstrip())
2. scores = list(map(int, sys.stdin.readline().split()))
3. 점수 수정하기
	3.1 m = max(scores)
    3.2 scores[i] = scores[i]/m*100
4. 평균 : sum(scores)/n

🔑 答案用紙

import sys

n = int(sys.stdin.readline().rstrip())
scores = list(map(int, sys.stdin.readline().split()))

m = max(scores)
for i in range(n):
    scores[i] = scores[i]/m*100
print(sum(scores)/n)

💡 コンセプト