문제 링크입니다: https://www.acmicpc.net/problem/17826
17826번: 나의 학점은?
3학년인 홍익이는 이번 학기 전공필수 과목인 운영체제(OS) 수업을 들었다. 수업을 마치고, 얼마 후 교수님께서 클래스넷을 통해 전 학생의 중간고사, 기말고사, 과제점 점수를 만점 기준 300점으로 환산하여 클래스넷에 올려주셨다. 물끄러미 점수를 바라보던 홍익이는, 불현듯 장학금을 꼭 받아야 된다는 사실이 떠올랐다. "운영체제 수업을 A0 이상 받지 못하면, 장학금을 받기 어려운데..." 교수님께서는 운영체제 첫 수업 시간에 학점 분포도를 다음과 같이 설
www.acmicpc.net
조건문이 많아서 귀찮았던 기본적인 문제였습니다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
using namespace std; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
map<int, int> rank; | |
int idx = 1; | |
for (int i = 0; i < 50; i++) | |
{ | |
int score; | |
cin >> score; | |
rank[score] = idx++; | |
} | |
int hongikScore; | |
cin >> hongikScore; | |
int grade = rank[hongikScore]; | |
if (grade <= 5) | |
{ | |
cout << "A+\n"; | |
} | |
else if (grade <= 15) | |
{ | |
cout << "A0\n"; | |
} | |
else if (grade <= 30) | |
{ | |
cout << "B+\n"; | |
} | |
else if (grade <= 35) | |
{ | |
cout << "B0\n"; | |
} | |
else if (grade <= 45) | |
{ | |
cout << "C+\n"; | |
} | |
else if (grade <= 48) | |
{ | |
cout << "C0\n"; | |
} | |
else | |
{ | |
cout << "F\n"; | |
} | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 17828번 문자열 화폐 (0) | 2019.11.04 |
---|---|
백준 17827번 달팽이 리스트 (0) | 2019.11.04 |
백준 17836번 공주님을 구해라! (2) | 2019.11.04 |
백준 1799번 비숍 (4) | 2019.10.22 |
백준 15666번 N과 M (12) (0) | 2019.10.22 |