cf478C Table Decorations
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.
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.
Print a single integer t — the maximum number of tables that can be decorated in the required manner.
5 4 3
4
1 1 1
1
2 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.
这题被搞惨了……各种乱搞都不对啊
orz hzwer
如果最大的气球比另外两种的气球数量之和小,就可以直接组成sum/3个
否则全部都是2:1的方案
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
long long i,j,t,n,m,l,r,k,z,y,x;
long long g,b,ans;
int main()
{
scanf("%I64d%I64d%I64d",&r,&g,&b);
ans=min(min(min((r+g+b)/,r+g),r+b),b+g);
printf("%I64d\n",ans);
return ;
}
cf478C
cf478C Table Decorations的更多相关文章
- CF-478C Table Decorations (贪心)
Table Decorations Time limit per test: 1 second Memory limit per test: 256 megabytes Problem Descrip ...
- CodeForces 478C Table Decorations
Table Decorations Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u ...
- 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
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 ...
- 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 ...
- C. Table Decorations
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
随机推荐
- NLog 2.0.0.2000 使用实例
原文地址:http://www.cnblogs.com/sorex/archive/2013/01/31/2887174.html ---------------------------------- ...
- Array vs Linked List
Access: Random / Sequential 1. Array element can be randomly accessed using index 2. Random access f ...
- HDOJ-1013 Digital Roots
http://acm.hdu.edu.cn/showproblem.php?pid=1013 1.给出一个整数,求每一位上的数字之和 2.若求出的和大于1位,则对该和继续执行第1步,直至和的位数为1 ...
- 《数据通信与网络》笔记--IPSec
1.IP层的安全:IPSec IP层安全(IP security,IPsec)是由因特网工程任务组(IETF)设计用来为IP层的分组提供安全的一组协议.IPsec帮助 生成经过鉴别的与安全的IP层的分 ...
- POI导入数据
package util; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.I ...
- Install Cocos2d-x v3.3 on Ubuntu 14.04 & Ubuntu 14.10(转)
Install Cocos2d-x v3.3 on Ubuntu 14.04 & Ubuntu 14.10 1 get the source code sudo apt-get install ...
- PHP冒泡排序,选择排序,插入排序
1 冒泡排序是两个元素相互比较,找到最小值,然后冒泡到最后,代码如下:
- strut2 自己定义文件上传错误信息
在文件上传过程中我们能够指定拦截器对文件类型.后缀名.大小进行设定,action中的配置: <interceptor-ref name="fileUpload"> &l ...
- HDU 1863:畅通project(带权值的并查集)
畅通project Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- CentOS6.5 --安装orale 11g(下)
(7) 建立Oracle系统用户和安装目录 创建一个主组oinstall和一个副组dba.命令如下: groupadd oinstall groupadd dba 创建oracle安装文件 m ...