https://www.acmicpc.net/problem/25206
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 |
댓글