CF478C.Table Decorations

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can be decorated if we know number of balloons of each color?

Your task is to write a program that for given values r, g and b will find the maximum number t of tables, that can be decorated in the required manner.

你有 rr 个红色气球、gg 个绿色气球和 bb 个蓝色气球。为了装饰宴会中的一张桌子,恰好需要三个气球。挂在同一张桌子上的三个气球不能是同一种颜色。已知每种颜色气球的数量,最多能装饰多少张桌子 tt?

你的任务是编写一个程序,对于给定的 rr、gg 和 bb,求出满足上述要求所能装饰的最大桌子数 tt。

输入格式

The single line contains three integers r, g and b (0 ≤ r, g, b ≤ 2·109) — the number of red, green and blue baloons respectively. The numbers are separated by exactly one space.

单行包含三个整数 rr、gg 和 bb(0 ≤ r, g, b ≤ 2⋅1090 \le r,\,g,\,b \le 2\cdot10^9),分别表示红色、绿色和蓝色气球的数量。这些数字之间恰好由一个空格分隔。

输出格式

Print a single integer t — the maximum number of tables that can be decorated in the required manner.

输出一个整数 tt —— 按照要求所能装饰的桌子的最大数量。

输入输出样例

  • 输入#1

    5 4 3

    输出#1

    4
  • 输入#2

    1 1 1

    输出#2

    1
  • 输入#3

    2 3 3

    输出#3

    2

说明/提示

In the first sample you can decorate the tables with the following balloon sets: "rgg", "gbb", "brr", "rrg", where "r", "g" and "b" represent the red, green and blue balls, respectively.

在第一个样例中,你可以用以下气球组合来装饰桌子:“rgg”、“gbb”、“brr”、“rrg”,其中“r”、“g”和“b”分别代表红色、绿色和蓝色气球。

输入解题思路,AI测评打分。不知道怎么写?

首页