CodeforcesRound#273(Div.2)CTableDecorations_html/css_WEB-ITnose
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了CodeforcesRound#273(Div.2)CTableDecorations_html/css_WEB-ITnose,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2318字,纯文字阅读大概需要4分钟。
内容图文
![CodeforcesRound#273(Div.2)CTableDecorations_html/css_WEB-ITnose](/upload/InfoBanner/zyjiaocheng/399/702f1460b9bb43f5bb603cb1c52f7611.jpg)
Table Decorations
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 r, g 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 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.
Sample test(s)
input
5 4 3
output
input
1 1 1
output
input
2 3 3
output
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.
解题思路:用三种颜色的气球装饰桌子,每个桌子装饰三个气球,并且规定每个桌子不能只用一种颜色的气球装饰,给出三种颜色气球的的个数,求最多可以装饰多少个桌子。
很显然,讨论一下,两种较少的气球的个数的和是否小于最多气球的个数的一半,若小于,则每个桌子用两个个数最多的气球,再加上另两种气球中的任一个即可;若不小于,则最大值为三种气球的总个数的平均数。
AC代码:
#include#include #include #include #include #include #include #include
内容总结
以上是互联网集市为您收集整理的CodeforcesRound#273(Div.2)CTableDecorations_html/css_WEB-ITnose全部内容,希望文章能够帮你解决CodeforcesRound#273(Div.2)CTableDecorations_html/css_WEB-ITnose所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。