문제 링크입니다: www.acmicpc.net/problem/13866
13866번: 팀 나누기
입력은 네 개의 정수 A, B, C 및 D가 포함된 한 줄로 구성되며 4명의 스킬 레벨이 주어진다. (0 ≤ A ≤ B ≤ C ≤ D ≤ 104)
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 <algorithm> | |
using namespace std; | |
const int MAX = 4; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int scores[MAX]; | |
for (int i = 0; i < MAX; i++) | |
{ | |
cin >> scores[i]; | |
} | |
sort(scores, scores + MAX); | |
int result = (scores[0] + scores[3]) - (scores[1] + scores[2]); | |
cout << abs(result) << "\n"; | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 14038번 Tournament Selection (0) | 2021.03.16 |
---|---|
백준 13985번 Equality (0) | 2021.03.16 |
백준 13610번 Volta (2) | 2021.03.15 |
백준 13597번 Tri-du (0) | 2021.03.15 |
백준 13311번 행운의 편지 (0) | 2021.03.15 |