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 ...
随机推荐
- sap的内核升级,修补了源代码保护的方式
众所周知,在SAP的内核位701或者之前的版本中,我们可以通过向源代码的中加入"*@#@@[SAP]"这样的代码,来实现对源代码的保护.但是在内核升级到721和以后的版本中,你会发 ...
- 痞子衡嵌入式:MCUBootFlasher v3.0发布,为真实的产线操作场景而生
-- 痞子衡维护的NXP-MCUBootFlasher工具(以前叫RT-Flash)距离上一个版本(v2.0.0)发布过去一年半以上了,这一次痞子衡为大家带来了全新版本v3.0.0,从这个版本开始,N ...
- 网络编程 — Windows TCP服务端和客户端
1. 服务端 #include <iostream> #include <signal.h> #include <forward_list> #include &l ...
- 虚拟化kvm的搭建
虚拟化, 是指通过虚拟化技术将一台计算机虚拟为多台逻辑计算机 ,在一台计算机上同时运行多个逻辑计算机,每台逻辑计算机可运行不同的操作系统,并且应用程序都可以在相互独立的空间内运行而互不 ...
- linux 文件结构体和文件描述符号的学习
https://blog.csdn.net/cywosp/article/details/38965239
- Oracle数据库误删除数据恢复(Oracle闪回功能)
一.启用行移动功能 alter table table_name enable row movement ; 二.可查询之前某一个时间点的数据(默认是1440分钟,即24小时内的数据) select ...
- python ---strip()方法,split()方法,删除字符串开头或结尾,字符串分隔
本文介绍了strip()方法,split()方法, 字典的按键值访问的方法, 1.Python strip() 方法用于移除字符串头尾指定的字符(默认为空格)或字符序列. 注意:该方法只能删除开头或是 ...
- kafka背着你做了什么?
Kafka中有broker.主题.分区.副本等概念,底层有日志和日志分片. 我们先简单介绍一下这些概念,做个类比. broker可以简单理解为一台物理机,其实一台机器上可以有多个broker进程,但是 ...
- Kwp2000协议的应用(程序原理篇)
作者:良知犹存 转载授权以及围观:欢迎添加微信:becom_me 总述 接上篇文章Kwp2000协议的应用(硬件原理使用篇),本篇针对kwp2000协议标准的服务ID详细介绍,以及针对程序实现 ...
- 【C#】对两张图片进行矩阵运算会怎么样?
对两张图片进行矩阵运算会怎么样? 在学习<线性代数>的矩阵运算时,突然想到图片也可以算是一种矩阵,那么对图片进行矩阵的运算会出现什么样的效果呢?为了满足好奇,便用C#写了个对图片进行矩阵运 ...