传送门

https://www.cnblogs.com/violet-acmer/p/10201535.html

题解:

  这题没什么好说的,读懂题意就会了。

比赛代码:

 #include<iostream>
using namespace std; int y,b,r;
int Solve()
{
if(b < || r < )
return ;
for(int i=y;i >= ;--i)
if(b >= i+ && r >= i+)
return *(i+);
return ;
}
int main()
{
cin>>y>>b>>r;
cout<<Solve();
return ;
}

暴力O(n)

赛后整理代码:

 #include<iostream>
#include<cstdio>
using namespace std; int y,b,r; int Solve()
{
if(b >= y+ && r >= y+)
return *(y+);
if(y >= b- && r >= b+)
return *b;
if(b >= r- && y >= r-)
return *(r-);
return ;
}
int main()
{
scanf("%d%d%d",&y,&b,&r);
printf("%d\n",Solve());
return ;
}

O(1)

Good Bye 2018 A. New Year and the Christmas Ornament的更多相关文章

  1. Good Bye 2018

    Good Bye 2018 2018年最后一场CF,OVER! 弱弱的我只能做出3道A,B,D~~~~ 最后几分钟,感觉找到了C题的规律,结束的那一刻,提交了一发 "Wrong answer ...

  2. Good Bye 2018 (A~F, H)

    目录 Codeforces 1091 A.New Year and the Christmas Ornament B.New Year and the Treasure Geolocation C.N ...

  3. Codeforces Good Bye 2018

    咕bye 2018,因为我这场又咕咕咕了 无谓地感慨一句:时间过得真快啊(有毒 A.New Year and the Christmas Ornament 分类讨论后等差数列求和 又在凑字数了 #in ...

  4. Codeforces:Good Bye 2018(题解)

    Good Bye 2018! 题目链接:https://codeforces.com/contest/1091 A. New Year and the Christmas Ornament 题意: 给 ...

  5. Good Bye 2018题解

    Good Bye 2018题解 题解 CF1091A [New Year and the Christmas Ornament] 打完cf都忘记写题解了qwq 题意就是:给你一些黄,蓝,红的球,满足蓝 ...

  6. CF Good Bye 2018

    前言:这次比赛爆炸,比赛时各种想多,导致写到\(D\)题时思路已经乱了,肝了\(1\)个多小时都没肝出来,\(B\)题中途因为没开\(long\ long\)又被\(HACK\)了..\(C\)题因为 ...

  7. Good Bye 2018 D. New Year and the Permutation Concatenation

    传送门 https://www.cnblogs.com/violet-acmer/p/10201535.html 题意: 求 n 的所有全排列组成的序列中连续的 n 个数加和为 n*(n+1)/2 的 ...

  8. Good Bye 2018 C. New Year and the Sphere Transmission

    传送门 https://www.cnblogs.com/violet-acmer/p/10201535.html 题意: n 个people,编号1~n,按顺时针方向围城一圈: 初始,编号为1的peo ...

  9. Good Bye 2018 B. New Year and the Treasure Geolocation

    传送门 https://www.cnblogs.com/violet-acmer/p/10201535.html 题意: 在二维空间中有 n 个 obelisk 点,n 个 p 点: 存在坐标T(x, ...

随机推荐

  1. 二、kubernetes环境搭建

    主要内容 1.环境准备(2主机) 2.安装流程 3.问题分析 4.总结 环境配置(2主机) 系统:CentOS 7.3 x64 网络:局域网(VPC) 主机: master:172.16.0.17 m ...

  2. Stream、FileStream、MemoryStream的区别

    1.Stream:流,在msdn的定义:提供字节序列的一般性视图,Stream提供了读写流的方法是以字节的形式从流中读取内容.而我们经常会用到从字节流中读取文本或者写入文本,微软提供了StreamRe ...

  3. Base64 总结

    Base64编码是解决一些无法打印的字符无法显示的问题,将8位的ascii编码转换为6位的表示64个可见字符的算法. 具体而言,首先将编码每三个分成一组,将三个字符转换为总长为24位的二进制 数字,将 ...

  4. raise missingsectionheadererror:file containe no section headers问题解决

    本人亲测,遇到这个问题,就换到管理员方式运行命令 因为太小白,所以这次重新装包的时候切换到D盘了,想着省一点儿C盘内存,结果,每次pip install安装的时候都是这个问题,中间还有什么反序列失败, ...

  5. 日期T转换

    日期转换 在startup.csd ConfigureServices方法里 services.AddMvc().AddJsonOptions(o => { o.SerializerSettin ...

  6. docker-安装技巧

    使用官方脚本安装 curl -fsSL "https://get.docker.com/" | sh 使用yum 安装是可以查看版本 yum list docker-ce.x86_ ...

  7. linux-shell系列4-init

    #!/bin/bash # 过滤出MAC地址MAC=`ifconfig |awk '{print $5}'|sed -n '1p;1q'` # 过滤网卡名字NET_NAME=`ifconfig |aw ...

  8. BZOJ4205卡牌配对——最大流+建图优化

    题目描述 现在有一种卡牌游戏,每张卡牌上有三个属性值:A,B,C.把卡牌分为X,Y两类,分别有n1,n2张. 两张卡牌能够配对,当且仅当,存在至多一项属性值使得两张卡牌该项属性值互质,且两张卡牌类别不 ...

  9. DNSCrypt

    DNSCrypt 来源 https://www.cnblogs.com/qiudabai/articles/9219840.html https://www.opendns.com/about/inn ...

  10. eclipse 保存html 提示 save could not be completed

    重启ecplise 即可