No.91 Red, Green, and Blue Stones
Problem Statement
One accessory can be made by using one stone of each of the 3 types: red, green, and blue.
Two stones of the same color can be exchanged for one stone of a different color.
What is the maximum number of accessories that can be made from the red, green, and blue stones you initially have?
Input
R G B
R is the number of red stones, G is the number of green stones, and B is the number of blue stones.
R,G,B are each integers greater than or equal to 0. ($0 \le R,G,B \le 10^7=10000000$)
Output
Output the number of accessories that can be made on one line.
Do not forget the newline at the end.
Sample
Sample 1
Input
2 1 1
Output
1
There are 2 red stones, 1 green stone, and 1 blue stone.
One accessory can be made by using 1 stone of each color.
One red stone remains, but no more accessories can be made.
Sample 2
Input
1 0 3
Output
1
There are 1 red stone, 0 green stones, and 3 blue stones.
There is no green stone, but 2 blue stones can be changed into 1 green stone.
Thus, one accessory can be made by using 1 red, 1 green, and 1 blue stone.
Sample 3
Input
2 2 0
Output
0
There are 2 red stones, 2 green stones, and 0 blue stones.
In this case, no accessory can be made no matter what you do.
Sample 4
Input
5 18 36
Output
16
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
nmnmnmnmnmnmnm