codeforces478C
Table Decorations
你有r个红的,g个绿的和b个蓝的气球。要为宴会布置一张桌子,你恰好需要三个气球。附在桌子上的三个气球不应该有相同的颜色。如果我们知道每种颜色的气球的数量,最多可以装饰多少张桌子?
您的任务是编写一个程序,对于给定的值r、g和b,它将找到表的最大数量t,并且可以按照所需的方式进行装饰。
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.
Examples
5 4 3
4
1 1 1
1
2 3 3
2
Note
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.
sol:搞了半天挂了无数次(菜菜菜菜菜菜菜菜菜菜菜菜菜菜菜菜)被日爆了!!!
发现对于a,b,c在大部分情况下都可以凑到总个数不到三个为止(即(a+b+c/3))
注意我说的是大多数,来看一组数据 100000000 1 1
这个最多只有一种,这类情况就是a,b,c中最大的数比另外两个的和的两倍还大,这类的答案就是另外两个的和
Ps:代码短但是好难啊qaq

翻车现场↑
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read()
{
ll s=;
bool f=;
char ch=' ';
while(!isdigit(ch))
{
f|=(ch=='-'); ch=getchar();
}
while(isdigit(ch))
{
s=(s<<)+(s<<)+(ch^); ch=getchar();
}
return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
if(x<)
{
putchar('-'); x=-x;
}
if(x<)
{
putchar(x+''); return;
}
write(x/);
putchar((x%)+'');
return;
}
#define W(x) write(x),putchar(' ')
#define Wl(x) write(x),putchar('\n')
ll a,b,c;
int main()
{
ll Max;
R(a); R(b); R(c);
Max=max(max(a,b),c);
if(Max>*(a+b+c-Max)) Wl(a+b+c-Max);
else Wl((a+b+c)/);
return ;
}
/*
input
5 4 3
output
4 input
1 1 1
output
1 input
2 3 3
output
2 input
100 99 56
output
85
*/
codeforces478C的更多相关文章
随机推荐
- oracle expdp导出时报 ora-39070:无法打开日志文件
在通过expdp导出命令导出某个用户的对象时出现以下截图错误: ORA-39002:操作无效 ORA-39070:无法打开日志文件 ORA-39087:目录名<directory>无效 该 ...
- Gym101237C The Palindrome Extraction Manacher、SAM、倍增
传送门 假设字符串\(B,D\)满足\(|B| \geq |D|\),那么一定会有\(B=rev(D)+T\),其中\(T\)是一个回文串. 考虑枚举回文串\(T\)的中心\(p\),找到以\(p\) ...
- WPF效果(GIS二维篇)
距离上次发东西已经过去了貌似不知多少天了,突然发现自己懒得总结了.这毛病感觉不好,还得写点东西来充实一下自己,不然这样整天浑浑噩噩的过日子,也太平淡了,不管怎么说,起码得给自己的经历留下点东西吧.闲话 ...
- Xamarin Android ListView 控件使用
在项目中通常用到了ListView控件,示例如下: create the listitem class ,eg; public class ColorItem { public string Colo ...
- Web 应用 WEB框架 HTTP协议 初识Django
----------------------------财富存在于人的思想里,你没找到路,不等于没有路,你想知道将来要得到什么,你必须知道现在应该先做什么和先放弃什么! [web 应用] web应用 ...
- mysqldump 和mysqlbinlog
一.mysqldump 1.备份test库 #mysqldump -uroot -p' test >test.sql 2.备份 -B参数 ' -B test >test_B.sql --B ...
- UnderWater+SDN论文之三
Software-Defined Underwater Acoustic Modems: Historical Review and the NILUS Approach Source: IEEE J ...
- 闽江学院软件学院2016级JAVA构建之法-学生自学兴趣小组招募通知
为提升我2016级学生提升JAVA软件开发学习氛围,鼓励更多同学通过自学.团队学习.在线(社区)学习等方式学习并掌握JAVA课程,尤其是鼓励同学们通过微软中国邹欣老师所倡导的"构建之法&qu ...
- 关于php,python,javascript文件或者模块导入引入的区别和联系
前言: 我们经常看到编程语言之间,文件或者模块的引来引去的,但是他们在各个编程语言之间有什么区别和联系呢? 1.javascript (1).全局引入方式: <script src='xxxxx ...
- Effective java ---遵守普遍接受的命名规则
alibaba的java命名规范如下: . [强制]代码中的命名均不能以下划线或美元符号开始,也不能以下划线或美元符号结束. 反例: _name / __name / $Object / name_ ...