問題一覧 > 通常問題

No.91 Red, Green, and Blue Stones

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 383
作問者 : nmnmnmnmnmnmnm
お気に入りにしたユーザー ProblemId : 200 / 自分の提出
問題文最終更新日: 2026-06-25 07:01:19
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 57 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。