백준25206: 너의 평점은
문제
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
25
26
27
28
29
30
31
32
33
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
HashMap<String, Double> map = new HashMap<>();
map.put("A+", 4.5);
map.put("A0", 4.0);
map.put("B+", 3.5);
map.put("B0", 3.0);
map.put("C+", 2.5);
map.put("C0", 2.0);
map.put("D+", 1.5);
map.put("D0", 1.0);
map.put("F", 0.0);
double sum = 0;
double sumScore = 0;
for (int i = 0; i < 20; i++) {
String subject = sc.next();
double score = sc.nextDouble();
String grade = sc.next();
if (grade.equals("P")) {
continue;
}
sum += map.get(grade) * score;
sumScore += score;
}
System.out.println(sum / sumScore);
}
}
댓글남기기