Algorithm/Baekjoon

백준 단계별로 풀기 4단계 if문 사용해보기 - 평균은 넘겠지 (4344 문제) Python 2 답안

Bonita SY 2019. 1. 16. 22:26
728x90
반응형

백준 단계별로 풀기 4단계


test_case = int(input())

i = 0

result_list = list()


while i < test_case:

        each_case = raw_input()

        each_case_list = each_case.split(" ")

        student_cnt = int(each_case_list.pop(0))

        total_score = 0

        for score in each_case_list:

                total_score += int(score)

        avg_cnt = 0

        for score in each_case_list:

                if int(score) > (total_score/student_cnt):

                        avg_cnt += 1

        result_list.append("%.3f" % float((float(avg_cnt) / float(student_cnt)) * 100))

        i+= 1


for result in result_list:

        print str(result)+"%"


728x90
반응형