Algorithm/C++
[백준 BoJ] 2875 - 대회 or 인턴
cgy12306
2021. 3. 25. 16:45
#include<iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// N 여자, M 남자, K 인턴
int N, M, K, team = 0;
cin >> N >> M >> K;
while (N > 1 && M > 0 && N+M-K>2) {
N -= 2;
M--;
team++;
}
cout << team;
return 0;
}