본문 바로가기

PS_Baekjoon

[백준 C++] 6840번 : Who is in the middle?

https://www.acmicpc.net/problem/6840

 

6840번: Who is in the middle?

In the story Goldilocks and the Three Bears, each bear had a bowl of porridge to eat while sitting at his/her favourite chair. What the story didn’t tell us is that Goldilocks moved the bowls around on the table, so the bowls were not at the right seats

www.acmicpc.net

코드 :

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
   int arr[5];
	for(int i=0; i<3; i++){
		cin >> arr[i];
	}
	sort(arr,arr+3);
	cout << arr[1] << '\n'; 
}