문제 : https://www.acmicpc.net/problem/10817

 

풀이

벡터에 세 수를 넣고 정렬하여 두번째 값을 출력

 


전체코드(C++14)

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
	int a, b, c;
	vector<int>v;
	cin >> a >> b >> c;
	v.push_back(a);
	v.push_back(b);
	v.push_back(c);
	sort(v.begin(), v.end());
	cout << v[1];
}