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. SpringBoot 导入插件报错 Cannot resolve plugin org.springframework.boot:spring-boot-maven-plugin:2.4.1

    使用 maven 导入插件的时候报错: Cannot resolve plugin org.springframework.boot:spring-boot-maven-plugin:2.4.1 我的 ...

  2. kubernets之Ingress资源

    一  Ingress集中式的kubernets服务转发控制器 1.1  认识Ingress的工作原理 注意:图片来源于kubernets in action一书,如若觉得侵权,请第一时间联系博主进行删 ...

  3. Databricks 第8篇:把Azure Data Lake Storage Gen2 (ADLS Gen 2)挂载到DBFS

    DBFS使用dbutils实现存储服务的装载(mount.挂载),用户可以把Azure Data Lake Storage Gen2和Azure Blob Storage 账户装载到DBFS中.mou ...

  4. C++ STL 栈和队列

    栈和队列 头文件 #include<queue> // 队列 #include<stack> //栈 定义方式 //参数就是数据类型 stack<int> s; q ...

  5. 【2020CSP-S模拟赛day5】总结

    爆零自闭赛 写在前面 于2022.11.1 这一次题目质量很高(以至于什么都不会) 再一度体验了省选Orz.比赛大体情况,刨去std, wzc神仙230分,比剩下的加起来都高.zyz神仙60分. 其余 ...

  6. java虚拟机入门(二)-探索内存世界

    上节简单介绍了一下jvm的内存布局以及简单概念,那么对于虚拟机来说,它是怎么一步步的让我们能执行方法的呢: 1.首先,jvm启动时,跟个小领导一样会根据配置参数(没有配置的话jvm会有默认值)向大领导 ...

  7. Redis二进制安全

    为了便于理解,举一个例子: 在很多编辑器中,都会默认/n是换行字符,也就意味着一串字符存进去,涉及/n都会做一个默认的转义处理,这在编辑语言中,C也有这个特性,例如字符串Hello,\0 World! ...

  8. linux系统层面调优

    linux系统层面调优和常见的面试题 - 云+社区 - 腾讯云 https://cloud.tencent.com/developer/article/1664287

  9. 公共错误码 - 支付宝开放平台 https://opendocs.alipay.com/open/common/105806

    公共错误码 - 支付宝开放平台 https://opendocs.alipay.com/open/common/105806

  10. Hugo 博客中文指南(基础教程)

    1. 安装 Hugo 从 Hugo 项目主页下载 Releases 文件,解压 hugo.exe 文件到 C:\Windows\System32 目录下. 2. 创建站点 hugo new site ...