[백준] #4344 평균은 넘겠지 python
2022. 12. 21. 17:12
https://www.acmicpc.net/problem/4344
4344번: 평균은 넘겠지
대학생 새내기들의 90%는 자신이 반에서 평균은 넘는다고 생각한다. 당신은 그들에게 슬픈 진실을 알려줘야 한다.
www.acmicpc.net
소숫점 처리 방법을 배웠다 !
print(f"{}")
방법도 있지만, .format 방법이나 round도 있음을 알았다.
N = int(input())
for _ in range(N):
num_list = list(map(int, input().split()))
rate = num_list[0]
result_val = 0
for i in range(1,len(num_list)):
result_val += num_list[i]
result_tmp = result_val/rate
cnt = 0
for i in num_list[1:]:
if result_tmp < i:
cnt += 1
print("{:.3f}".format(cnt/rate * 100)+"%")
'Programming > Algorithm' 카테고리의 다른 글
[백준] #1065 한수 python (0) | 2022.12.21 |
---|---|
[백준] #4673 셀프 넘버 python (0) | 2022.12.21 |
[백준] #8958 OX퀴즈 python (0) | 2022.12.21 |
[백준] #5597 과제 안 내신 분..? python (0) | 2022.12.21 |
[백준] #1110 std::stoi c++ (0) | 2022.12.21 |