문제 링크입니다: www.acmicpc.net/problem/17388
17388번: 와글와글 숭고한
첫 번째 줄에 숭실대학교의 참여도, 고려대학교의 참여도, 한양대학교의 참여도를 의미하는 세 자연수 S, K, H가 공백으로 구분되어 주어진다. (0 ≤ S, K, H ≤ 100) 세 대학의 참여도는 모두 다르다.
www.acmicpc.net
This file contains hidden or 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 <string> | |
#include <algorithm> | |
using namespace std; | |
const int HUNDRED = 100; | |
const int MAX = 3; | |
typedef struct | |
{ | |
int score; | |
string name; | |
}University; | |
bool cmp(University a, University b) | |
{ | |
return a.score < b.score; | |
} | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int S, K, H; | |
cin >> S >> K >> H; | |
if (S + K + H >= HUNDRED) | |
{ | |
cout << "OK\n"; | |
return 0; | |
} | |
University universities[MAX] = { { S, "Soongsil" },{ K, "Korea" },{ H, "Hanyang" } }; | |
sort(universities, universities + MAX, cmp); | |
cout << universities[0].name << "\n"; | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 17874번 Piece of Cake! (0) | 2021.03.26 |
---|---|
백준 17863번 FYI (0) | 2021.03.26 |
백준 17362번 수학은 체육과목 입니다 2 (0) | 2021.03.26 |
백준 17009번 Winning Score (0) | 2021.03.26 |
백준 16785번 ソーシャルゲーム (0) | 2021.03.26 |