time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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 rg and b will
find the maximum number t of tables, that can be decorated in the required manner.

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.

Sample test(s)
input
5 4 3
output
4
input
1 1 1
output
1
input
2 3 3
output
2
这题一开始以为是模拟题,模拟了很久发现非常麻烦,后来看了代码,发现只要两个算式就行了。1、如果较小的两个数的和的两倍比第三个数小,那么直接输出这两个数的和,否则输出三个数的平均数。
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
__int64 a[10];
__int64 n,m,i,j;
while(scanf("%I64d%I64d%I64d",&a[0],&a[1],&a[2])!=EOF)
{
sort(a,a+3);
if((a[0]+a[1])*2<=a[2]){
printf("%I64d\n",a[0]+a[1]);continue;
}
else printf("%I64d\n",(a[1]+a[2]+a[0])/3);
}
return 0;
}

C. Table Decorations的更多相关文章

  1. CodeForces 478C Table Decorations

    Table Decorations Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u ...

  2. cf478C Table Decorations

    C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...

  3. C. Table Decorations(Codeforces Round 273)

    C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...

  4. 【CODEFORCES】 C. Table Decorations

    C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...

  5. 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 ...

  6. 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 ...

  7. 贪心 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 ...

  8. 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 ...

  9. CF-478C Table Decorations (贪心)

    Table Decorations Time limit per test: 1 second Memory limit per test: 256 megabytes Problem Descrip ...

随机推荐

  1. Centos7安装Jenkins和目录迁移

    Centos7安装Jenkins和目录迁移 内容: 安装Jenkins和相关的配置 尝试目录迁移,模拟磁盘空间不足 1. 安装Jenkins和配置 安装 根据Jenkins的官方安装指引,安装步骤如下 ...

  2. 【Shell】使用awk sed获取一行内容的两个值

    突然有需求需要一个脚本,同时获取到每一行数据的两个值,下面做了一个例子模板,仅供记录参考 cat test.txt  id=1,name=zclinux1 id=2,name=zclinux2 id= ...

  3. SAP中使用FTP服务

    SAP中简单的FTP技术实现基本上如下几个步骤: 1.SM59建立FTP的RFC destination. 可以通过执行SAP的标准程序RSFTP005,自动创建两个名为SAPFTP何SAPFTPA的 ...

  4. Ice系列--强大如我IceGrid

    前言 IceGrid是一个提供服务定位和服务激活的组件,但它的功能远不止于此.从它的命名可以看出它的设计理念-网格计算(grid computing).网格计算被定义为由一系列关联的廉价计算机组成的计 ...

  5. JAVA获取当前文件路径this.getClass().getResource方法详细讲解

    public class Test { public void run() { // TODO Auto-generated method stub System.out.println(" ...

  6. 彻底解决小程序无法触发SESSION问题

    一.首先找到第一次发起网络请求的地址,将服务器返回set-cookie当全局变量存储起来 wx.request({ ...... success: function(res) { console.lo ...

  7. 3.kafka安装配置

    kafka安装配置 ### 1.集群规划 hadoop102 hadoop103 hadoop104 zk zk zk kafka kafka kafka jar包下载 http://kafka.ap ...

  8. scala/java等其他语言从CSV文件中读取数据,使用逗号','分割可能会出现的问题

    众所周知,csv文件默认以逗号","分割数据,那么在scala命令行里查询的数据: 可以看见,字段里就包含了逗号",",那接下来切割的时候,这本应该作为一个整体 ...

  9. 【实战】ZooKeeper 实战

    1. 前言 这篇文章简单给演示一下 ZooKeeper 常见命令的使用以及 ZooKeeper Java客户端 Curator 的基本使用.介绍到的内容都是最基本的操作,能满足日常工作的基本需要. 如 ...

  10. 洛谷P6218

    感觉此题是P4317 花神的数论题的变形版 Description 求一段区间内二进制中 \(0\) 的个数不小于 \(1\) 的个数的数的个数 Solution 数位 DP 先考虑状态转移方程式,如 ...