Three Garlands~Educational Codeforces Round 35
2 seconds
256 megabytes
standard input
standard output
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it periodically changes its state — sometimes it is lit, sometimes not. Formally, if i-th garland is switched on during x-th second, then it is lit only during seconds x, x + ki,x + 2ki, x + 3ki and so on.
Mishka wants to switch on the garlands in such a way that during each second after switching the garlands on there would be at least one lit garland. Formally, Mishka wants to choose three integersx1, x2 and x3 (not necessarily distinct) so that he will switch on the first garland during x1-th second, the second one — during x2-th second, and the third one — during x3-th second, respectively, and during each second starting from max(x1, x2, x3) at least one garland will be lit.
Help Mishka by telling him if it is possible to do this!
The first line contains three integers k1, k2 and k3 (1 ≤ ki ≤ 1500) — time intervals of the garlands.
If Mishka can choose moments of time to switch on the garlands in such a way that each second after switching the garlands on at least one garland will be lit, print YES.
Otherwise, print NO.
2 2 3
YES
4 2 3
NO
In the first example Mishka can choose x1 = 1, x2 = 2, x3 = 1. The first garland will be lit during seconds 1, 3, 5, 7, ..., the second — 2, 4, 6, 8, ..., which already cover all the seconds after the 2-nd one. It doesn't even matter what x3 is chosen. Our choice will lead third to be lit during seconds1, 4, 7, 10, ..., though.
In the second example there is no way to choose such moments of time, there always be some seconds when no garland is lit.
这题想不出了,于是暴力一发,就A了
暴力出奇迹啊
仔细想,这题确实傻逼
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <stack>
#include <string>
#include <math.h>
#include <vector>
using namespace std;
const int maxn = 2e5 + ;
const int INF = 0x7fffffff; int main() {
int a[];
while(scanf("%d%d%d", &a[], &a[], &a[]) != EOF) {
sort(a, a + );
if (a[] == ) {
printf("YES\n");
continue;
}
if (a[] == && a[] == ) {
printf("YES\n");
continue;
}
if (a[] == && a[] == && a[] == ) {
printf("YES\n");
continue;
}
if (a[] == && a[] == && a[] == ) {
printf("YES\n");
continue;
}
printf("NO\n");
}
return ;
}
Three Garlands~Educational Codeforces Round 35的更多相关文章
- Educational Codeforces Round 35 (Rated for Div. 2)
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...
- Educational Codeforces Round 35 A. Nearest Minimums【预处理】
[题目链接]: Educational Codeforces Round 35 (Rated for Div. 2) A. Nearest Minimums time limit per test 2 ...
- Educational Codeforces Round 35 B/C/D
B. Two Cakes 传送门:http://codeforces.com/contest/911/problem/B 本题是一个数学问题. 有a个Ⅰ类球,b个Ⅱ类球:有n个盒子.将球放入盒子中,要 ...
- Educational Codeforces Round 35 (Rated for Div. 2)A,B,C,D
A. Nearest Minimums time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Educational Codeforces Round 35
Nearest Minimums 相同的数里最小的数里的最小距离 Solution Two Cakes Solution Three Garlands 瞎比试 Solution Inversion C ...
- Educational Codeforces Round 35 B. Two Cakes【枚举/给盘子个数,两份蛋糕块数,最少需要在每个盘子放几块蛋糕保证所有蛋糕块都装下】
B. Two Cakes time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- 【Educational Codeforces Round 35 D】Inversion Counting
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 排列中交换任意两个数字. 排列的逆序对个数的奇偶性会发生变化. 翻转这个过程其实就是len/2对数字发生交换. 交换了偶数次的话,不 ...
- 【Educational Codeforces Round 35 C】Two Cakes
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 直觉题. 感觉情况会很少. 毕竟间隔太大了.中间肯定有一些数字达不到. 有1肯定可以 2 2 x肯定可以 3 3 3也可以 2 4 ...
- 【Educational Codeforces Round 35 B】Two Cakes
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 从小到大枚举x. 看看a/x+b/x是不是大于等于n 是的话. 看看是不是两种蛋糕都能凑一堆. 也即x的最大枚举量是min(a,b) ...
随机推荐
- springboot+Druid+mybatis整合
一.添加Druid.MySQL连接池.mybatis依赖 <!--整合Druid--> <dependency> <groupId>com.alibaba</ ...
- 在haoodp-2.7.3 HA的基础上安装Hbase HA
前提安装好hadoop基于QJM的高可用 node1 HMaster node2 HMaster.HRegionServer node3 HRegionServer node4 HRegionServ ...
- 制作linux系统U盘并使用U盘安装CentOS7.6系统
目录 一.制作linux启动盘 1.1. 准备工作 1.2. 制作linux系统U盘 二.使用U盘安装Centos7.6 2.1. 使用U盘启动 2.2. 更改 ...
- 《Linux就该这么学》,刘小伙实在人,给打个广告
本书是由全国多名红帽架构师(RHCA)基于最新Linux系统共同编写的高质量Linux技术自学教程,极其适合用于Linux技术入门教程或讲课辅助教材,目前是国内最值得去读的Linux教材,也是最有价值 ...
- 【js】【跨域问题】前后端分离的跨域问题
最近在研究nodejs,php的前后端分离相关东西,在调用接口的时候碰到一些跨域的问题,经过一段时间的摸索,总结出来的一些东西 php采用的是yii框架,登录的机制或者调用接口都需要前端传递cooki ...
- Hive学习路线图
- 将Mnist手写数字库转化为图片形式 和标签形式
Mnist 数据文件有两种,一种是图片文件,一种是标签文件,那么如何把他们解析出来呢? (1)解析图片文件 可以看出在train-images.idx3-ubyte中,第一个数为32位的整数(魔数,图 ...
- 笔记-scrapy-extentions
笔记-scrapy-extentions 1. extentions 1.1. 开始 The extensions framework provides a mechanism for ...
- Trident学习笔记(一)
1. Trident入门 Trident ------------------- 三叉戟 storm高级抽象,支持有状态流处理: 好处是确保消费被处理一次: 以小批次方式处理输入流,得到精准一次性处理 ...
- Object Pascal中文手册 经典教程
Object Pascal 参考手册 (Ver 0.1)ezdelphi@hotmail.com OverviewOverview(概述)Using object pascal(使用 object p ...