首页 > 其他分享 >C. Table Decorations(Codeforces)(规律)

C. Table Decorations(Codeforces)(规律)

时间:2023-04-20 22:44:38浏览次数:40  
标签:__ blue output Codeforces number int64 Decorations input Table


C. Table Decorations



time limit per test



memory limit per test



input



output



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

rg and b will find the maximum number t



Input



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



t



Sample test(s)



input



5 4 3



output



4



input



1 1 1



output



1



input



2 3 3



output



2



Note



rgg", "gbb", "brr", "rrg", where "r", "g" and "b" represent the red, green and blue balls, respectively.











只要把规律找到,题目就做完了。



#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main()
{
    __int64 a,b,c;
    while(scanf("%I64d%I64d%I64d",&a,&b,&c)!=EOF)
    {
        __int64 x = a + b + c;
        __int64 y = x/3;
        __int64 z = y;
        if(a>=2*y)
        {
            z = b + c;
        }
        else if(b>=2*y)
        {
            z = a + c;
        }
        else if(c>=2*y)
        {
            z = a + b;
        }
        if(y>=z)
        {
            printf("%I64d\n",z);
        }
        else
        {
            printf("%I64d\n",y);
        }

    }
    return 0;
}



标签:__,blue,output,Codeforces,number,int64,Decorations,input,Table
From: https://blog.51cto.com/u_14834528/6210785

相关文章

  • CodeForces 34A Reconnaissance 2
     Reconnaissance2TimeLimit:2000MS     MemoryLimit:262144KB     64bitIOFormat:%I64d&%I64uSubmit Status Practice CodeForces34ADescriptionn soldiersstandinacircle.Foreachsoldierhisheight ai isknown.Areco......
  • linux IPtable防火墙 禁止和开放端口
    评:1、关闭所有的INPUTFORWARDOUTPUT只对某些端口开放。下面是命令实现:iptables-PINPUTDROPiptables-PFORWARDDROPiptables-POUTPUTDROP再用命令iptables-L-n查看是否设置好,好看到全部DROP了这样的设置好了,我们只是临时的,重启服务器还是会恢复......
  • codeforces round The Monster and the Squirrel 529B (数学规律)
    TheMonsterandtheSquirrelTimeLimit: 1000MS MemoryLimit: 262144KB 64bitIOFormat: %I64d&%I64uSubmit StatusDescriptionArithemonsteralwayswakesupveryearlywiththefirstrayofthesunandthefirstthingshedoesisfeedinghersqu......
  • 如何快速实现table固定第一行
    固定列这个需求在项目中经常遇到,但是固定行这个需求还是大姑娘上轿——头一回。关于vxe-table这个插件就不过多介绍了,感兴趣的可以自行搜索。刚开始看到这个需求的时候,第一想法是插件文档上有没有类似于和固定列一样设置个fixed参数就能解决问题,翻开文档一看,果然,没有这个属性......
  • CentOS linux关闭iptables防火墙
    评:linux服务器下防火墙为iptables组件,在安装一些软件的时候,iptables防火墙会阻止我们一些必要的连接,所以,我代购的美国服务器,荷兰服务器等海外服务器iptables初始状态为关闭。如果有一些服务器没有关闭iptables,并且你还特别想关闭它,哪么以下命令,你可以能用的上。查看iptables状......
  • K8s为啥要启用bridge-nf-call-iptables内核参数?用案例给你讲明白
    使用kubernetes遇到最多的70%问题都可以归于网络问题,最近发现如果内核参数:bridge-nf-call-iptables设置不当的话会影响kubernetes中Node节点上的Pod通过ClusterIP去访问同Node上的其它pod时会有超时现象,复盘记录一下排查的前因后因。1、问题现象集群环境为K8sv......
  • vue3学习之tabler组件Layout布局
    上一篇使用的bootstrap-vue-next项目迭代很快,考虑还未发文档和正式版本(自己菜)改用原生bootstrap模板tabler项目。tabler安装运行不想安装可直接打开tabler\demo目录下html文件浏览查看效果#获取后目录下运行npminstall#需要先安装https://github.com/oneclick/rubyinst......
  • mac使用Stable Diffusion基础篇
    准备工作提前安装git.python等必要工具 1、git拉取WebUI仓库 gitclonehttps://github.com/AUTOMATIC1111/stable-diffusion-webui2、下载StableDiffusionModelshttps://huggingface.co/CompVis/stable-diffusion-v-1-4-original  3、启动下载完成后,把下载的s......
  • el-table拖动排序
    html<el-tableref="multipleTable":data="tableData"align="left"borderclass="mytable"row-key="id"><el-table-column:index="indexMethod"align="center"type=&q......
  • Codeforces Round 850 (Div. 2, based on VK Cup 2022 - Final Round) E. Monsters (h
    传送门详细题解传送门  抄的ygg代码,向在这里说一下刚开始没看懂的部分。  求答案的时候是把所有的当前为止的所有数值加起来减去一个从1开始并且公差为1的等差数列的前size项和。其中size是当前最多能用到哪个位置,满足前size项能构成1,2,3,....,sz这样的形式。  假设我们......