cf478C Table Decorations
来源:互联网 发布:sql数据库价格 编辑:程序博客网 时间:2024/06/08 00:54
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)/3,r+g),r+b),b+g); printf("%I64d\n",ans); return 0;}
- cf478C Table Decorations
- C. Table Decorations
- C. Table Decorations
- CF C - Table Decorations
- C. Table Decorations
- 【CODEFORCES】 C. Table Decorations
- Table Decorations(思维题)
- Table Decorations(贪心)
- Table Decorations CodeForces
- C. Table Decorations
- codeforces-#478C. Table Decorations
- Table Decorations(规律题)
- CodeForces 478C--Table Decorations
- codeforces 478c Table Decorations
- CF 273C Table Decorations
- #273.2 C. Table Decorations(贪心)
- CodeForces-478C Table Decorations
- Codeforces-478C-Table Decorations
- 嘴足柞专篆咨追撰桌转棕椎综仔邹坠爪左
- ADS学习1:破解ADS安装程序
- 尊最座酌爪纂最邹字庄妆左自孜纵壮纵子
- errno多线程安全问题
- 合并数组ab
- cf478C Table Decorations
- Cocos2d-x_CCControlSwitch(开关类)介绍
- maven 配置篇 之pom.xml
- C++ 60分钟入门教程 - 5、C++引用
- 程序员生存定律:打造属于自己的稀缺性
- 姿转纵仔孜拙缀庄资装坐邹酌椎仔驻资钻
- cf478D Red-Green Towers
- git 指令整理
- iOS8中的UIScreen、UIWindow、键盘尺寸、状态栏尺寸的改动