근본없는 코딩
[C++] 백준25206 너의 평점은 본문
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cout << fixed;
cout.precision(6);
char leacture[100], credit[5], grade[5];
double s = 0, c = 0, total = 0;
for (int i = 0; i < 20; i++) {
cin >> leacture >> credit >> grade;
switch (grade[0]) {
case 'A': s = 4; break;
case 'B': s = 3; break;
case 'C': s = 2; break;
case 'D': s = 1; break;
case 'F': s = 0; break;
case 'P': s = 0; credit[0] = '0'; break;
}
if (grade[1] == '+') s += 0.5;
c += credit[0] - '0';
total += (credit[0] - '0') * s;
}
cout << total/c << '\n';
return 0;
}
'✔ Online Judge' 카테고리의 다른 글
[Python] 백준 2583 영역 구하기 (3) | 2024.02.05 |
---|---|
[C++] 백준1316 그룹 단어 체커 (0) | 2023.06.29 |
[C++] 백준2941 크로아티아 알파벳 (0) | 2023.06.29 |
[C++] 백준4344 평균은 넘겠지 (0) | 2023.06.29 |
[C++] 백준1157 단어공부 (0) | 2023.06.29 |