본문 바로가기
python-algorithm

백준 25206 너의 평점은

by 무적김두칠 2024. 2. 6.

https://www.acmicpc.net/problem/25206

 

25206번: 너의 평점은

인하대학교 컴퓨터공학과를 졸업하기 위해서는, 전공평점이 3.3 이상이거나 졸업고사를 통과해야 한다. 그런데 아뿔싸, 치훈이는 깜빡하고 졸업고사를 응시하지 않았다는 사실을 깨달았다! 치

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def sol(scores):
    grades = {'A+'4.5,
              'A0'4.0,
              'B+'3.5,
              'B0'3.0,
              'C+'2.5,
              'C0'2.0,
              'D+'1.5,
              'D0'1.0,
              'F'0.0}
    total_gpa = total_class = 0
    for score in scores:
        name, times, result = score
        times = float(times)
        if result == 'P':
            continue
        total_gpa += times * grades[result]
        total_class += times
    return total_gpa/total_class
 
if __name__ == '__main__':
    scores = [input().split() for i in range(20)]
    print(sol(scores))
 
cs

 

반응형

'python-algorithm' 카테고리의 다른 글

백준 1308 D-Day  (1) 2024.02.08
leetcode 2937. Make Three Strings Equal  (0) 2024.02.08
leetcode 3028. Ant on the Boundary  (0) 2024.02.06
leetcode 3019. Number of Changing Keys  (0) 2024.02.05
백준 9063 대지  (0) 2024.01.24

댓글