피너클의 it공부방
백준 2754 학점계산 (c++) : 피너클 본문
728x90
반응형
https://www.acmicpc.net/problem/2754
2754번: 학점계산
어떤 사람의 C언어 성적이 주어졌을 때, 평점은 몇 점인지 출력하는 프로그램을 작성하시오. A+: 4.3, A0: 4.0, A-: 3.7 B+: 3.3, B0: 3.0, B-: 2.7 C+: 2.3, C0: 2.0, C-: 1.7 D+: 1.3, D0: 1.0, D-: 0.7 F: 0.0
www.acmicpc.net
노가다 구현문제다.
#include <iostream>
#include <string>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string str;
cin >> str;
if (str == "A+") cout << "4.3" << endl;
else if (str == "A0") cout << "4.0" << endl;
else if (str == "A-") cout << "3.7" << endl;
else if (str == "B+") cout << "3.3" << endl;
else if (str == "B0") cout << "3.0" << endl;
else if (str == "B-") cout << "2.7" << endl;
else if (str == "C+") cout << "2.3" << endl;
else if (str == "C0") cout << "2.0" << endl;
else if (str == "C-") cout << "1.7" << endl;
else if (str == "D+") cout << "1.3" << endl;
else if (str == "D0") cout << "1.0" << endl;
else if (str == "D-") cout << "0.7" << endl;
else if (str == "F") cout << "0.0" << endl;
}
전체코드다.
728x90
반응형
'백준' 카테고리의 다른 글
백준 4999 아! (c++) : 피너클 (0) | 2022.07.23 |
---|---|
백준 9086 문자열 (c++) : 피너클 (0) | 2022.07.22 |
백준 4101 크냐? (c++) : 피너클 (0) | 2022.07.20 |
백준 14440 정수 수열 (c++) : 피너클 (0) | 2022.07.19 |
백준 2535 아시아 정보올림피아드 (c++) : 피너클 (0) | 2022.07.19 |
Comments