반응형
[문제 출처]
https://www.acmicpc.net/problem/4344
4344번: 평균은 넘겠지
대학생 새내기들의 90%는 자신이 반에서 평균은 넘는다고 생각한다. 당신은 그들에게 슬픈 진실을 알려줘야 한다.
www.acmicpc.net
[소스 코드]
#4344
import sys
input = sys.stdin.readline
T = int(input())
for i in range(T):
data = list(map(int,input().split()))
n = data[0]
score = data[1:]
avg = sum(score)/n
cnt = 0
for j in score:
if j > avg:
cnt += 1
result = (cnt / n) * 100
print('%.3f' %result + '%')
반응형
'알고리즘 > python' 카테고리의 다른 글
[python/파이썬] 백준 11050 이항 계수1 / 11051 이항 계수 2 (0) | 2022.11.23 |
---|---|
[python/파이썬] 백준 2525 오븐 시계 (0) | 2022.11.22 |
[python/파이썬] 백준 18870 좌표 압축 (0) | 2022.11.18 |
[python/파이썬] 백준 10814 나이순 정렬 (0) | 2022.11.17 |
[python/파이썬] 좌표 정렬하기2 (0) | 2022.11.16 |