#GD0000184. Đội hoàn hảo (Perfect Team)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Đội hoàn hảo (Perfect Team)
Perfect Team
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A perfect programming team has exactly three members, including at least one coder and at least one mathematician. There are students who specialize only in coding, who specialize only in mathematics, and with neither specialization. Nobody has both specializations, and each student may join at most one team. A team may contain more than one student of a specialization as long as it meets the requirements. Find the maximum number of perfect teams.
Input
The only line contains three nonnegative integers , , and : the numbers of coders, mathematicians, and students without either specialization.
Output
Print one integer: the maximum number of perfect teams that can be formed.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
4 4 1
Output
3
Explanation
There are four coders, four mathematicians, and one unskilled student. Form one team of one from each group, one team of two coders and one mathematician, and one team of one coder and two mathematicians. All nine students make three valid teams. As each team has three members, more than teams are impossible.
Example 2
Input
10 1 10
Output
1
Explanation
Only one student specializes in mathematics. Every team needs a mathematician, so at most one team can be formed. Selecting one student from each group achieves one valid team.