【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\)的. 这两次错误的提交是因为我第一开始想的求 ...
随机推荐
- (转)Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPL
转自:http://blog.csdn.net/huashnag/article/details/9357517 Starting Oracle Universal Installer... Chec ...
- REGEXP_LIKE,REGEXP_INSTR,REGEXP_SUBSTR,REGEXP_REPLACE
参考: http://www.cnblogs.com/scottckt/archive/2012/10/11/2719562.html http://www.jb51.net/article/3842 ...
- 【习题 5-8 UVA - 230】Borrowers
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 用map+set写个模拟就好. 3个区域 书架.桌子.别人的手上. 其中前两个区域的书都能借出去. [代码] #include &l ...
- 对照jQuery和AngularJS的不同思维模
对照jQuery和AngularJS的不同思维模 Question 如果我已经熟悉了怎样使用jQuery来开发client应用.我如今打算使用AngularJS.请描写叙述一下有那些思维模式方面的东西 ...
- iOS开发 - Quartz2D画图
Quartz 2D简单介绍 是一个二维画图引擎,同一时候支持iOS和Mac系统 Quartz 2D能完毕的工作 绘制图形 : 线条\三角形\矩形\圆\弧等 绘制文字 绘制\生成图片(图像) 读取\生成 ...
- MFC只允许进行一个实例
APP---InitInstance() 放在所有程序运行前 //只允许运行一个实例 BOOL bfound = FALSE; hmutex = CreateMutex(NULL,TRUE,&quo ...
- [Docker] Build a Simple Node.js Web Server with Docker
Learn how to build a simple Node.js web server with Docker. In this lesson, we'll create a Dockerfil ...
- 网站访问优化(二):开启apache服务器gzip压缩
昨天,把带宽从1M升级到2M,使用cdn版本的jquery之后,网站访问速度由平均5s(在禁止缓存的情况下,使用缓存大概在2.8s)下降到2.8s的样子. 今天,继续优化. 第1步: 把图片进行了 ...
- boost::any的一般使用方法
01.#include <iostream> 02.#include <list> 03.#include <boost/any.hpp> 04. ...
- Ubuntu10.04下安装Qt4和创建第一个Qt程序
1.首先安装Qt4并采用Qt Creator进行开发演示 (1)在Terminal中输入: sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfi ...