【Codeforces Round #438 B】Race Against Time
【链接】h在这里写链接
【题意】
【题解】
【错的次数】
【反思】
【代码】
#include <bits/stdc++.h>
using namespace std; bool bo[20][20];
int h,m,s,t1,t2; int nex(int x)
{
if (x+1>12)
return 1;
else
return x + 1;
} int pre(int x)
{
if (x-1<=0)
return 12;
else
return x-1;
} int main()
{
//freopen("F:\\rush.txt","r",stdin);
memset(bo,true,sizeof bo);
scanf("%d%d%d%d%d",&h,&m,&s,&t1,&t2);
if (m>0 || s >0)
{
bo[nex(h)][h] = false;
bo[h][nex(h)] = false;
}else
{
bo[nex(h)][h] = false;
bo[h][nex(h)] = false;
bo[pre(h)][h] = false;
bo[h][pre(h)] = false;
}
if (s==0)
{
if (m%5==0)
{
int x = m/5;
if (x==0) x = 12;
bo[pre(x)][x] = false;
bo[x][pre(x)] = false;
bo[nex(x)][x] = false;
bo[x][nex(x)] = false;
}else
{
int x = m/5;
if (x==0) x = 12;
bo[x][nex(x)] = false;
bo[nex(x)][x] = false;
}
}else
{
int x = m/5;
if (x==0) x = 12;
bo[x][nex(x)] = false;
bo[nex(x)][x] = false;
} if (s%5==0)
{
int x = s/5;
if (x==0) x = 12;
bo[pre(x)][x] = false;
bo[x][pre(x)] = false;
bo[x][nex(x)] = false;
bo[nex(x)][x] = false;
}else{
int x = s/5;
if (x==0) x = 12;
bo[nex(x)][x] = false;
bo[x][nex(x)] = false;
}
while (bo[t1][pre(t1)])
{
t1 = pre(t1);
if (t1==t2)
return cout <<"YES"<<endl,0;
}
while (bo[t1][nex(t1)])
{
t1 = nex(t1);
if (t1==t2)
return cout << "YES"<<endl,0;
}
cout << "NO"<<endl;
return 0;
}
【Codeforces Round #438 B】Race Against Time的更多相关文章
- 【Codeforces Round #438 C】 Qualification Rounds
[链接]h在这里写链接 [题意] 给你n个问题,每个人都知道一些问题. 然后让你选择一些问题,使得每个人知道的问题的数量,不超过这些问题的数量的一半. [题解] 想法题. 只要有两个问题. 这两个问题 ...
- 【Codeforces Round #438 A】Bark to Unlock
[链接]h在这里写链接 [题意] 在这里写题意 [题解] 枚举它是在连接处,还是就是整个字符串就好. [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/stdc+ ...
- 【Codeforces Round 438 A B C D 四个题】
题目所在比赛的地址在这里呀 A. Bark to Unlock ·述大意: 输入一个目标串.然后输入n(1<=n<=100)个串,询问是否可以通过这些串收尾相接或者它本身拼出目 ...
- Codeforces Round #438 (Div.1+Div.2) 总结
本来兴致勃勃的想乘着这一次上紫,于是很早很早的到了机房 但是好像并没有什么用,反而rating-=47 Codeforces Round #438(Div.1+Div.2) 今天就这样匆匆的总结一下, ...
- 【Codeforces #312 div2 A】Lala Land and Apple Trees
# [Codeforces #312 div2 A]Lala Land and Apple Trees 首先,此题的大意是在一条坐标轴上,有\(n\)个点,每个点的权值为\(a_{i}\),第一次从原 ...
- 【Codeforces Round 431 (Div. 2) A B C D E五个题】
先给出比赛地址啦,感觉这场比赛思维考察非常灵活而美妙. A. Odds and Ends ·述大意: 输入n(n<=100)表示长度为n的序列,接下来输入这个序列.询问是否可以将序列划 ...
- 【Codeforces Round】 #432 (Div. 2) 题解
Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) A. Arpa and a research in Mexi ...
- 【Codeforces Round】 #431 (Div. 2) 题解
Codeforces Round #431 (Div. 2) A. Odds and Ends time limit per test 1 second memory limit per test ...
- 【Codeforces Round 1137】Codeforces #545 (Div. 1)
Codeforces Round 1137 这场比赛做了\(A\).\(B\),排名\(376\). 主要是\(A\)题做的时间又长又交了两次\(wa4\)的. 这两次错误的提交是因为我第一开始想的求 ...
随机推荐
- 非常全的linux面试笔试题及参考答案
一.填空题: 1. 在Linux系统中,以 文件 方式访问设备 . 2. Linux内核引导时,从文件/etc/fstab 中读取要加载的文件系统. 3. Linux文件系统中每个文件用 i节点来标识 ...
- Loadrunner--关联详解
当录制脚本时,VuGen会拦截client端(浏览器)与server端(网站服务器)之间的对话,并且通通记录下来,产生脚本.在VuGen的Recording Log中,您可以找到浏览器与服务器之间所有 ...
- unmapping error
否则,会映射一个Getch的器件,就会报unmapping 的error
- AMBA标准
AMBA标准定义了三种不同的总线 高级高性能总线(AHB): 高级系统总线(ASB):-----用的比较少 高级外设总线(APB). 基于AMBA的典型微控制器: 典型的AMBA AHB系统设计包含以 ...
- 使用mybatis generator 生成annotation形式的mapper
最近使用mybatisgenerator时,希望生成annotation的mapper,在网上基本桑没有相关配置,记录,做以下记录: <?xml version="1.0" ...
- 《从零開始学Swift》学习笔记(Day 63)——Cocoa Touch设计模式及应用之单例模式
原创文章,欢迎转载.转载请注明:关东升的博客 什么是设计模式.设计模式是在特定场景下对特定问题的解决方式.这些解决方式是经过重复论证和測试总结出来的. 实际上.除了软件设计,设计模式也被广泛应用于其它 ...
- 3、C++快速入门
参考书籍: C++程序设计教程_第二版_钱能 //篇幅较少,适合快速学习 C++ Primer Plus 第六版 中文版 //篇幅较大,讲的非常详细 C++一般必须包含的头文件是#inc ...
- RISC-V工具链环境(基于Debian/Linux操作系统)
RISC-V工具链环境(基于Debian/Linux操作系统) 提要 Debian/Linux虚拟机导入 启动虚拟机 SiFive/Nuclei SDK运行指南 Debian/Linux虚拟机存储位置 ...
- [Ramda] Complement: Logic opposite function
Take a function as arguement, and the function only return true of false. If the function 'f' return ...
- UVA - 1161 Objective: Berlin(最大流+时序模型)
题目大意:有n个城市m条航线.给出每条航线的出发地,目的地,座位数,起飞时间和到达时间(所给形式为HHMM.记得转化),再给出城市A和B.和到达城市B的最晚时间.如今问一天内最多有多少人能从A飞到B, ...