열심히 문제를 푸시는 여러분은 A+입니다.
#include <iostream>
#include <string>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
double n = 0;
double ans = 0;
for (int i = 0; i < 20; i++) {
string name;
double num;
string score;
cin >> name >> num >> score;
if (score == "P")
continue;
else{
n += num;
if (score == "A+")
ans += num * 4.5;
else if (score == "A0")
ans += num * 4.0;
else if (score == "B+")
ans += num * 3.5;
else if (score == "B0")
ans += num * 3.0;
else if (score == "C+")
ans += num * 2.5;
else if (score == "C0")
ans += num * 2.0;
else if (score == "D+")
ans += num * 1.5;
else if (score == "D0")
ans += num * 1.0;
}
}
cout << ans / n;
return 0;
}