Algorithm/BOJ
[백준/1546] 평균 (with 파이썬)
Potato potage
2022. 10. 6. 16:34
반응형
✔ 문제
✔ 풀이
n = int(input())
score = list(map(int, input().split()))
max_s = max(score)
for i in range(n):
score[i] = score[i] / max_s * 100
print(sum(score) / n)
✔ 후기
max_s에는 max 함수를 사용해 score의 최댓값을 저장,
for문으로 score에 새로운 점수를 계산해서 저장,
sum 함수를 사용해 score 전체 합을 구한 후 과목의 수로 나눠 평균을 구했다.
반응형