您的位置:首页 > 其它

CodeForces 478C Table Decorations

2015-08-30 20:15 323 查看
Table Decorations
Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u
Submit Status Practice CodeForces 478C

Description

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.

Input

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.

Output

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

Sample Input

Input
5 4 3


Output
4


Input
1 1 1


Output
1


Input
2 3 3


Output
2


Hint

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.

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int main()
{
long long r,g,b;
long long a[10];
long long i,j,k;
while(scanf("%I64d %I64d %I64d",&r,&g,&b)!=EOF)
{
long long s=0;
a[1]=r,a[2]=g,a[3]=b;
sort(a+1,a+4);
s=s+a[1];
long long q=(a[2]+a[3])-a[1]*2,o;
o=q/3;
if(o<=a[2])
s=s+o;
else
s=s+a[2];
printf("%I64d\n",s);
}
return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: