CodeForces 478C 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 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
5 4 3
4
1 1 1
1
2 3 3
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的更多相关文章
- 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 ...
- 贪心 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 ...
- C. Table Decorations(Codeforces Round 273)
C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...
- 【CODEFORCES】 C. Table Decorations
C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...
- 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 ...
- 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 ...
- cf478C Table Decorations
C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...
- CF-478C Table Decorations (贪心)
Table Decorations Time limit per test: 1 second Memory limit per test: 256 megabytes Problem Descrip ...
- 【Codeforces 478C】Table Decorations
[链接] 我是链接,点我呀:) [题意] 给你r,g,b三种颜色的气球 每张桌子要放3个气球 但是3个气球的颜色不能全都一样 (允许两个一样,或者全都不一样) 问你最多能装饰多少张桌子 [题解] 先把 ...
随机推荐
- 夺命雷公狗mongodb之----mongodb---1---的下载,安装,连接
首先登录mongodb的官方网站即可进行下载: https://www.mongodb.com/download-center?jmp=nav#community 然后到wamp目录下创建一个mong ...
- zw版【转发·台湾nvp系列Delphi例程】HALCON SetLineStyle2
zw版[转发·台湾nvp系列Delphi例程]HALCON SetLineStyle2 procedure TForm1.Button1Click(Sender: TObject);var img : ...
- 根据linux内核源码查找recv返回EBADF(errno 9)的原因
linux的内核版本是2.6.18,x86_64. man里的解释是: EBADF The argument s is an invalid descriptor 我的模拟测试环境是: 前端loadr ...
- Spring项目启动时执行初始化方法
一.applicationContext.xml配置bean <bean id="sensitiveWordInitUtil" class ="com.hx.daz ...
- Haproxy安装与配置
一.Haproxy概念 Haproxy提供高可用性.负载均衡以及基于TCP和HTTP应用的代理,支持虚拟主机,它是免费.快速并且可靠的一种解决方案.Haproxy特别适用于那些负载特大的web站点,这 ...
- PHP笔记随笔
1.CSS控制页面文字不能复制: body{-webkit-user-select:none;} 2.[php过滤汉字和非汉字] $sc="aaad....##--__i汉字过滤&quo ...
- for_each()的返回值
有三种办法可以从“运用了function object”的算法中获取“结果”或“反馈”: 1.在外部持有状态,并让function object指向它: 2.以by reference方式传递func ...
- javascript——web前端编程
一.弹出提示框: 连接 function disp_prompt() { var name=prompt("请输入您的名字","Bill Gates") ...
- python :eval将字符串转换成字典
#将字符串打印成字典 b=''' {'record': {'weight':20,'server':'100.1.7.9','maxconn':50},'backend': 'www.oldboy.o ...
- 【转】SVN 查看历史信息
转载地址:http://lee2013.iteye.com/blog/1074457 SVN 查看历史信息 通过svn命令可以根据时间或修订号去除过去的版本,或者某一版本所做的具体的修改.以下四个命令 ...