문제 링크입니다: www.acmicpc.net/problem/20976
20976번: 2 番目に大きい整数
3 つの整数 A, B, C が与えられる.これらのうち 2 番目に大きい数を出力せよ.
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 <algorithm> | |
using namespace std; | |
const int MAX = 3; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int arr[MAX]; | |
for (int i = 0; i < MAX; i++) | |
{ | |
cin >> arr[i]; | |
} | |
sort(arr, arr + MAX); | |
cout << arr[1] << "\n"; | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 1009번 분산처리 (0) | 2021.03.31 |
---|---|
백준 21185번 Some Sum (0) | 2021.03.30 |
백준 20673번 Covid-19 (0) | 2021.03.30 |
백준 20499번 Darius님 한타 안 함? (0) | 2021.03.30 |
백준 20353번 Atrium (0) | 2021.03.29 |