codeforces 868B
2 seconds
256 megabytes
standard input
standard output
Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox! Space and time replaced each other.
The entire universe turned into an enormous clock face with three hands — hour, minute, and second. Time froze, and clocks now show the time h hours, m minutes, s seconds.
Last time Misha talked with the coordinator at t1 o'clock, so now he stands on the number t1 on the clock face. The contest should be ready by t2 o'clock. In the terms of paradox it means that Misha has to go to number t2 somehow. Note that he doesn't have to move forward only: in these circumstances time has no direction.
Clock hands are very long, and Misha cannot get round them. He also cannot step over as it leads to the collapse of space-time. That is, if hour clock points 12 and Misha stands at 11 then he cannot move to 1 along the top arc. He has to follow all the way round the clock center (of course, if there are no other hands on his way).
Given the hands' positions, t1, and t2, find if Misha can prepare the contest on time (or should we say on space?). That is, find if he can move from t1 to t2 by the clock face.
Five integers h, m, s, t1, t2 (1 ≤ h ≤ 12, 0 ≤ m, s ≤ 59, 1 ≤ t1, t2 ≤ 12, t1 ≠ t2).
Misha's position and the target time do not coincide with the position of any hand.
Print "YES" (quotes for clarity), if Misha can prepare the contest on time, and "NO" otherwise.
You can print each character either upper- or lowercase ("YeS" and "yes" are valid when the answer is "YES").
12 30 45 3 11
NO
12 0 1 12 1
YES
3 47 0 4 9
YES
The three examples are shown on the pictures below from left to right. The starting position of Misha is shown with green, the ending position is shown with pink. Note that the positions of the hands on the pictures are not exact, but are close to the exact and the answer is the same.
说出来你们可能不信,这题到最后我都没做出来。
因为我没根本没有想到,秒针分针时针三个是联动的T T。
(Note that the positions of the hands on the pictures are not exact, but are close to the exact and the answer is the same.主要是这句话误导了我,我以为这句话就是为了强调其实图中的针和刻度是一致的,不用考虑三者的联动)
附事后ac代码:
1 #include <cstdio>
2 #include <cstring>
3 #include <iostream>
4 #include <string>
5 #include <algorithm>
6 #include <cmath>
7 using namespace std;
8 double nu[5];
9 int main() {
10 ios::sync_with_stdio(false);
11 for(int i = 0; i < 5; i++) {
12 cin>>nu[i];
13 if(i==0||i==3||i==4) nu[i]*=5;
14 if(nu[i]==60) nu[i]=0;
15 }
16 nu[1]+=nu[2]/60;
17 nu[0]+=nu[1]/60;
18 double t1 = min(nu[3],nu[4]);
19 double t2 = max(nu[3],nu[4]);
20 int flag =0;
21 for(int i = 0; i < 3; i++) {
22 if(nu[i] > t1 && nu[i] < t2) flag++;
23
24 }
25 if(flag==3 || flag==0) cout<<"YES"<<endl;
26 else cout<<"NO"<<endl;
27
28 return 0;
29 }
codeforces 868B的更多相关文章
- codeforces 868B Race Against Time
Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a si ...
- codeforces 868B The Eternal Immortality【暴力+trick】
B. The Eternal Immortality time limit per test 1 second memory limit per test 256 megabytes input st ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
- CodeForces - 261B Maxim and Restaurant
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...
随机推荐
- kafka(二)基本使用
一.Kafka线上集群部署方案 既然是集群,那必然就要有多个Kafka节点机器,因为只有单台机器构成的kafka伪集群只能用于日常测试之用,根本无法满足实际的线上生产需求. 操作系统: kafka由S ...
- linux设备注册
一.分配cdev cdev表示字符设备,使用cdev_alloc函数,cdev_alloc函数原型如下: /** * cdev_alloc() - allocate a cdev structure ...
- java实现Excel定制导出(基于POI的工具类)
我的需求: 项目中有一些工程表格需要导出,设计到行列合并,定制样式,原有工具类冗余,内聚性强.所以想写一个可以随意定制excel的工具类,工具类满足需求: 对于常用的工程表格有模板格式,可以任意插拔. ...
- 从HDFS中下载指定文件,如果本地文件与要下载的文件名称相同,则自动对下载的文件重命名。
1 import org.apache.hadoop.conf.Configuration; 2 import org.apache.hadoop.fs.*; 3 import org.apache. ...
- Compile-time Dependency Injection With Go Cloud's Wire 编译时依赖注入 运行时依赖注入
Compile-time Dependency Injection With Go Cloud's Wire - The Go Blog https://blog.golang.org/wire Co ...
- c++11之override关键字
明确是用来 覆盖 用来对虚函数的 从新实现 加上后编译器就会帮我们去检查这个语法 总结就是:c++11允许派生类显示的注明它将使用那个成员函数改写基类的虚函数 https://blog.csdn. ...
- JAXB学习(一):概述
pre.XML { background-color: rgba(255, 204, 204, 1); padding-left: 25px } JAXB是 Java Architecture for ...
- LOJ2130软件包
题目描述Linux用户和OSX用户一定对软件包管理器不会陌生.通过软件包管理器,你可以通过一行命令安装某一个软件包,然后软件包管理器会帮助你从软件源下载软件包,同时自动解决所有的依赖(即下载安装这个软 ...
- python 文件的方法
1.open() 方法 Python open() 方法用于打开一个文件,并返回文件对象,在对文件进行处理过程都需要使用到这个函数,如果该文件无法被打开,会抛出 OSError. 注意:使用 open ...
- ShowDoc,APIDoc,可道云API,语雀-适合IT企业的文档工具
ShowDoc,APIDoc,可道云API,语雀-适合IT企业的文档工具 一.ShowDoc官方文档及说明 1.1 它可以用来做什么 1.2 它都有些什么功能 1.3 使用在线的ShowDoc 1.4 ...