Table Decorations

Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

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 rg 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 rg 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[];
long long i,j,k;
while(scanf("%I64d %I64d %I64d",&r,&g,&b)!=EOF)
{
long long s=;
a[]=r,a[]=g,a[]=b;
sort(a+,a+);
s=s+a[];
long long q=(a[]+a[])-a[]*,o;
o=q/;
if(o<=a[])
s=s+o;
else
s=s+a[];
printf("%I64d\n",s);
}
return ;
}

CodeForces 478C Table Decorations的更多相关文章

  1. Codeforces Round #273 (Div. 2)-C. Table Decorations

    http://codeforces.com/contest/478/problem/C C. Table Decorations time limit per test 1 second memory ...

  2. 贪心 Codeforces Round #273 (Div. 2) C. Table Decorations

    题目传送门 /* 贪心:排序后,当a[3] > 2 * (a[1] + a[2]), 可以最多的2个,其他的都是1个,ggr,ggb, ggr... ans = a[1] + a[2]; 或先2 ...

  3. C. Table Decorations(Codeforces Round 273)

    C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...

  4. 【CODEFORCES】 C. Table Decorations

    C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...

  5. codeforces 的 Codeforces Round #273 (Div. 2) --C Table Decorations

    C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...

  6. Codeforces Round #273 (Div. 2)C. Table Decorations 数学

    C. Table Decorations   You have r red, g green and b blue balloons. To decorate a single table for t ...

  7. cf478C Table Decorations

    C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...

  8. CF-478C Table Decorations (贪心)

    Table Decorations Time limit per test: 1 second Memory limit per test: 256 megabytes Problem Descrip ...

  9. 【Codeforces 478C】Table Decorations

    [链接] 我是链接,点我呀:) [题意] 给你r,g,b三种颜色的气球 每张桌子要放3个气球 但是3个气球的颜色不能全都一样 (允许两个一样,或者全都不一样) 问你最多能装饰多少张桌子 [题解] 先把 ...

随机推荐

  1. java 与 R 相互调用

    https://www.r-project.org/ http://cos.name/2013/08/r-rjava-java/ http://blog.csdn.net/hwssg/article/ ...

  2. Headless MSBuild Support for SSDT (*.sqlproj) Projects

    http://sqlproj.com/index.php/2012/03/headless-msbuild-support-for-ssdt-sqlproj-projects/ Update: bre ...

  3. 三层架构和MVC模式

    目录[-] 1.三层架构 2.MVC 2.1 标准的MVC(Model-View-Controller) 2.2 Web MVC 3.三层架构和MVC的区别与联系 1.三层架构 三层架构(3-tier ...

  4. ASP.NET 中通过Form身份验证 来模拟Windows 域服务身份验证的方法

    This step-by-step article demonstrates how an ASP.NET   application can use Forms authentication to ...

  5. 操作系统,windows编程,网络,socket

    首发:个人博客,更新&纠错&回复 之前关于c/s的一篇博文只记了思路没记代码,而且表达不清晰,事后看不知所云,这个习惯要改. 这十几天学了点关于操作系统.windows编程和网络,主要 ...

  6. selenium webdriver设置超时

    webdriver类中有三个和时间相关的方法: 1.pageLoadTimeout 2.setScriptTimeout 3.implicitlyWait pageLoadTimeout from s ...

  7. 人工智能大数据,公开的海量数据集下载,ImageNet数据集下载,数据挖掘机器学习数据集下载

    人工智能大数据,公开的海量数据集下载,ImageNet数据集下载,数据挖掘机器学习数据集下载 ImageNet挑战赛中超越人类的计算机视觉系统微软亚洲研究院视觉计算组基于深度卷积神经网络(CNN)的计 ...

  8. TI CC2541的整体目标

    1. App端会发送一定数量的byte过来蓝牙, 每2个byte是一个汉字的编码. 2. 拿到汉字编码之后, 统计字符数量, 然后通过SPI, 搜索编码 3. 收到的编码, 每个汉字字符有32个byt ...

  9. VPS常用工具

    1.命令行工具 putty 在Mac下,可以直接使用超级终端 ssh username@ipaddress 2.可视化上传文件工具 WinSCP 在Mac下,使用 Cyberduck

  10. Shipyard远程API

    1.鉴权模块 1.1 Login,获取token POST  http://192.168.31.149:8080/auth/login Headers Content-Type: applicati ...