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 ...
随机推荐
- hdr(host), hdr_beg(host) , path_beg
ACL derivatives : hdr([<name>[,<occ>]]) : exact string match 字符串精确匹配 hdr_beg([<name&g ...
- Paint House 解答
Question There are a row of n houses, each house can be painted with one of the three colors: red, b ...
- Sum 类型题目总结
Sum类的题目一般这样: input: nums[], target output: satisfied arrays/ lists/ number 拿到题目,首先分析: 1. 是几个数的sum 2. ...
- Longest Common Prefix 解答
Question Write a function to find the longest common prefix string amongst an array of strings. Solu ...
- Spoj1771-Yet Another N-Queen Problem(精确覆盖)
Description After solving Solution to the n Queens Puzzle by constructing, LoadingTime wants to solv ...
- jdbc连接数据库工具类
import java.lang.reflect.Field; import java.sql.Connection; import java.sql.DriverManager; import ja ...
- fragment的入门DEMO
效果图: 代码如下: 1.main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLay ...
- Qt Assistant 工作机制
Qt Assistant 是Qt 的助手,我们在看帮助的时候要用到的,它可以记住上一次你访问的位置. 1. 所以在你调用Qt Assistant为我们自己的程序写help的时候要记得修改qhcp配 ...
- Apache-rhel5.8环境下编译安装
Apache安装过程 Step 1:安装包gcc或gcc-c++# yum install gcc#yum install gcc-c++ Step 2:安装包APR和APR-Utilapr-1.4. ...
- 《JavaScript 闯关记》之事件
JavaScript 程序采用了异步事件驱动编程模型.在这种程序设计风格下,当文档.浏览器.元素或与之相关的对象发生某些有趣的事情时,Web 浏览器就会产生事件(event).例如,当 Web 浏览器 ...