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. Mysql索引总结(一)

    数据库开发中索引的使用占了很重要的位置,好的索引会使数据库的读写效率加倍,烂的索引则会拖累整个系统甚至引发灾难. 索引分三类: index ----普通的索引,数据可以重复 unique ----唯一 ...

  2. 夺命雷公狗---DEDECMS----10dedecms双标签

    双标签基本语法如下: {dede:标签名 参数名=“值” 参数名2=“值”...} 内容...... {/dede} 我们先来查看下手册,如下所示: 我们先来用一个channel的标签来做实例,因为c ...

  3. C#制作Windows service服务系列二:演示一个定期执行的windows服务及调试(windows service)

    系列一: 制作一个可安装.可启动.可停止.可卸载的Windows service(downmoon原创) 系列二:演示一个定期执行的windows服务及调试(windows service)(down ...

  4. Android侧滑

    人人客户端有一个特效还是挺吸引人的,在主界面手指向右滑动,就可以将菜单展示出来,而主界面会被隐藏大部分,但是仍有左侧的一小部分同菜单一起展示. 据说人人客户端的这个特效是从facebook客户端模仿来 ...

  5. 161116、springmvc自己实现防止表单重复提交(基于注解)

    原理:在去某个页面直接生成一个随机数(这里使用的是UUID)并放入session中,用户提交表单时将这个随机数传入服务端与session中的值进行比较,如果不不存在或不相等,则认为是重复提交:如果相等 ...

  6. Android 常用工具类之LogUtil,可以定位到代码行,双击跳转

    package cn.utils; import android.util.Log; public class LogUtils { public static boolean isDebug = t ...

  7. mmap DMA【转】

    转自:http://blog.csdn.net/lihaoweiv/article/details/6275241 第 13 章  mmap 和 DMA 本章将深入探讨 Linux 内存管理部分,并强 ...

  8. wghd的git代码仓库分支管理说明【转】

    英文原文:http://www.nvie.com/posts/a-successful-git-branching-model/ 原文作者:Vincent Driessen 本文经Linux大棚博主总 ...

  9. Best Time to Buy and Sell Stock

    class Solution { public: int maxProfit(vector<int>& prices) { //eg: 5 6 2 3 1 4: // 记录i之前最 ...

  10. STM32F0系列MCU中断向量表的重映射

    最近使用了一款Cortex-M0内核的芯片STM32F030CC,发现它中断向量表的重映射方法与STM32F10x系列的有所区别,在这里记录与分享一下. 由于需要通过IAP进行固件升级,所以芯片的FL ...