传送门

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. flask Django保存session区别

    '''Django中,session保存在服务端的数据库中,数据库中保存请求用户的所有数据,服务端数据中{'随机字符串':加密后的客户相关信息}请求完成后,把随机字符串作为值,返回给客户端,保存在客户 ...

  2. replace只能输入小数

    case "checkPrice": tr.find(".layui-table-edit").keyup(function () { var $input = ...

  3. HTTP协议 - 使用php模拟get/post请求

    首先 有个疑问, 是不是只有浏览器才能发送http 请求? 答案肯定是错的,第一篇就说了,http是由请求行,请求头,请求主体三个部分组成,那么我们可不可以用代码来模拟一下get和post请求呢: 首 ...

  4. 【python练习题】程序4

    # 题目:输入某年某月某日,判断这一天是这一年的第几天? import time year = input('输入年份: \n') month = input('输入月份: \n') day = in ...

  5. Windows Server 2012 IIS 8 - 安装SSL证书

    从证书邮件里或者用户中心复制对应的SSL证书文件代码 把代码粘贴到TXT文本文件里面 然后另存为cer或是crt文件,注意编码为ANSI 中级证书和交叉证书也是按以上方法保存为crt或cer文件即可 ...

  6. 前端bug记录

    记录一下前端入门时期遇到的一些bug. 1.同步.异步问题 背景:Javascript语言的执行环境是单线程.即一次只能完成一个任务.若有多个任务则需排队逐个执行——前一个任务完成,再执行后一个任务. ...

  7. Spring 使用介绍(十)—— 单元测试

    一.概述 Spring测试框架提供了对单元测试的支持,以便使用spring的依赖注入和事务管理功能 maven依赖: <dependency> <groupId>junit&l ...

  8. Suffix

    $ 题目描述 给定一个序列\(A\),请你输出\(\sum_{1< i< j < k < h}A_iA_jA_kA_h(mod ~~1e9+7)\) \(Solution\) ...

  9. hashlib 模块用来进行hash

    hashlib的基本概述: python中的 hashlib 模块用来进行hash 或者md5加密,而且这种加密是不可逆的,所以这种算法又被称为摘要算法, 其支持Opennssl库提供的所有算法,包括 ...

  10. SpringMVC的缓存对静态资源的影响 304 Not Modified

    我们知道在springmvc的配置中,可以添加缓存,但是缓存到底对静态资源有什么影响? 测试 没有添加缓存 <mvc:resources mapping="/image/**" ...