Notice
Recent Posts
Recent Comments
Link
250x250
«   2025/08   »
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
Archives
Today
Total
관리 메뉴

피너클의 it공부방

백준 2754 학점계산 (c++) : 피너클 본문

백준

백준 2754 학점계산 (c++) : 피너클

피너클 2022. 7. 21. 13:58
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
반응형
Comments