#GD0000179. Trang trí bàn tiệc (Table Decorations)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Trang trí bàn tiệc (Table Decorations)
Table Decorations
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A banquet has red balloons, green balloons, and blue balloons. Decorating one table requires exactly three balloons, and those three must not all have the same color. Each balloon can be assigned to at most one table. Some balloons may remain unused. Find the maximum number of tables that can be decorated.
Input
The only line contains three nonnegative integers , , and : the numbers of red, green, and blue balloons, respectively.
Output
Print one integer: the maximum number of tables that can each receive exactly three balloons without all three having the same color.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
5 4 3
Output
4
Explanation
There are balloons, so at most tables are possible. Four valid triples are (red, green, green), (green, blue, blue), (blue, red, red), and (red, red, green). They use exactly all red, green, and blue balloons; no triple is monochromatic. Hence the answer is .
Example 2
Input
1 1 1
Output
1
Explanation
There is one balloon of each color. The three balloons decorate one table and are not all the same color. No balloons remain for another table.