Contest or Internship
InterviewTime limit1sMemory limit128 MB
Given female and male student counts and a number who must leave for internship, decide who to remove to maximize teams of 2 females and 1 male each.
- Level
Easy3 of 10
- Topics
- Greedy, Math, Simulation
- Solved
- No attempts yet
Problem
At a university, each programming contest team must consist of exactly 2 female students and 1 male student.
This year, N female students and M male students want to participate in the contest. Among these students, K students must instead participate in an internship program, and students who join the internship cannot compete.
Find the maximum number of contest teams that can be formed.
Input
The first line contains N, M, and K, separated by spaces.
- 0 <= N <= 100
- 0 <= M <= 100
- 0 <= K <= N + M
Output
Print the maximum number of teams that can be formed.