传送门

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. python设计模式第七天【建造者模式】

    1. 建造者模式UML图 2.应用场景 (1)专门创建具有符合属性的对象 3.代码实现 #!/usr/bin/env python #! _*_ coding: UTF-8 _*_ from abc ...

  2. Spring Boot 构建电商基础秒杀项目 (十一) 秒杀

    SpringBoot构建电商基础秒杀项目 学习笔记 新建表 create table if not exists promo ( id int not null auto_increment, pro ...

  3. 在 Web 页面使用 VLC 插件播放 m3u8 视频流 (360 极速模式)

    1. 背景 公司有个旧项目需要添加在线播放 m3u8 视频流,但是该流不知道什么原因使用 Video.js 或 hls.js 均无法播放,最后找到解决方案可使用 VLC 插件播放(360 极速模式下) ...

  4. 51nod2383

    2383 高维部分和 1 秒 131,072 KB 80 分 5 级题   输入一个长度为n的数组a[i],下标从0开始(0到n-1)保证n是2的整数次幂,对于每个i (0 <= i < ...

  5. Nginx 浏览器缓存

    L:97 一般都是 同时使用 浏览器与Nginx缓存

  6. henrylee2cn简单的rpc服务

    server 端package controllers import ( "github.com/henrylee2cn/teleport" "model/system& ...

  7. 19JDBC初体验

    一.JDBC常用类和接口 JDBC(Java DataBase Connectivity,java数据库连接)是一种用于执行SQL语句的Java API.JDBC是Java访问数据库的标准规范,可以为 ...

  8. HDU3507-Print Article-斜率dp入门题

    为了学CDQ分治,从斜率dp和凸包开始做吧.. 代码就是维护一个凸包.利用递增的性质丢掉不合适的点. http://www.cnblogs.com/Rlemon/p/3184899.html 代码学的 ...

  9. 前端 -- HTML内容

    HTML介绍 Wed服务本质 import socket sk = socket.socket() sk.bind(("127.0.0.1", 8080)) sk.listen(5 ...

  10. Cetos 7 系统安装备注事项

    说明:此篇内容为个人记录备注事项,具体的安装操作请参考其他教程: 系统安装: 公司的服务器型号为戴尔R330 卡片式服务器,安装过程中遇到一些问题,此文章中简单记录下 1.下载一份Cetos 系统镜像 ...