Table Decorations

CodeForces - 478C

你有r个红的,g个绿的和b个蓝的气球。要为宴会布置一张桌子,你恰好需要三个气球。附在桌子上的三个气球不应该有相同的颜色。如果我们知道每种颜色的气球的数量,最多可以装饰多少张桌子?

您的任务是编写一个程序,对于给定的值r、g和b,它将找到表的最大数量t,并且可以按照所需的方式进行装饰。

Input

The single line contains three integers rg 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

Input
5 4 3
Output
4
Input
1 1 1
Output
1
Input
2 3 3
Output
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的更多相关文章

随机推荐

  1. mysql 行转列 列转行

    一.行转列 即将原本同一列下多行的不同内容作为多个字段,输出对应内容. 建表语句 DROP TABLE IF EXISTS tb_score; CREATE TABLE tb_score( id ) ...

  2. Vue bus的使用(兄弟|非父子组件传值)-->可以使用一个空的Vue实例作为中央事件总线new Vue()

    1.在main.js中注册全局的bus  Vue.prototype.bus=new Vue(); 2.在组建中使用 子组建使用:this.bus.$emit('自定义事件名',data) metho ...

  3. 前端面试送命题(二)-callback,promise,generator,async-await

    前言 本篇文章适合前端架构师,或者进阶的前端开发人员:我在面试vmware前端架构师的时候,被问到关于callback,promise,generator,async-await的问题. 首先我们回顾 ...

  4. 【博客迁移】hyrepo.com

    博客迁移至 www.hyrepo.com

  5. Jvm 参数笔记

    Jvm参数含义 https://cloud.tencent.com/developer/article/1129474 从一道题说起 https://blog.csdn.net/crazylzxlzx ...

  6. Linux常见问题汇总

    Linux问题: ifconfig查看IP地下载报错:bash: ifconfig: commandnotfound 解决方法: 先执行 export PATH="$PATH:/sbin&q ...

  7. springboot在yml中配置控制台sql打印方法小结

    方法一: logging: level: debug level.io.renren: debug path: logs/ file: admin.log   方法二 logging:    leve ...

  8. css 图片文字垂直居中

    先来看张图片 相信很多css新手遇到过这种问题,就是当图片和文本显示在一行的时候,效果很奇葩,文字和图片没法对齐, 这时我们需要做的是: 1,先给块级元素设置 display: inline-bloc ...

  9. js判断手机机型,然后进行相对应的操作

    我们通过浏览器内置的userAgent来判断手机机型. 具体代码如下: var u = navigator.userAgent, app = navigator.appVersion; if(/App ...

  10. rem 适配

    postcss-pxtorem 是一款 postcss 插件,用于将单位转化为 rem lib-flexible 用于设置 rem 基准值 一.webpact postcss 插件将px转化为rem单 ...