PS/백준
[백준 4344번 ] 평균은 넘겠지 (파이썬/python)
BLUE_ERASER
2021. 6. 14. 11:07
728x90
https://www.acmicpc.net/problem/4344
4344번: 평균은 넘겠지
대학생 새내기들의 90%는 자신이 반에서 평균은 넘는다고 생각한다. 당신은 그들에게 슬픈 진실을 알려줘야 한다.
www.acmicpc.net
파이썬 문자열포메팅에대해 배울 수 있었음!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import sys
input = sys.stdin.readline
c = int(input())
for i in range(c):
arr = list(map(int, input().split()))
average = sum(arr[1:]) / arr[0]
num = 0
for a in arr[1:]:
if a > average:
num += 1
result = num / arr[0] * 100
print(str("%.3f" % result) + "%")
|
cs |
728x90