【链接】h在这里写链接


【题意】


时针、分钟、秒针走不过去。
问你从t1时刻能不能走到t2时刻

【题解】


看看时针、分钟、秒针的影响就好。
看看是不是在整时的位置就好。
然后看看影响到x不能到y;
然后从t1开始逆时针或顺时针一直走


【错的次数】


0

【反思】


在这了写反思

【代码】

#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的更多相关文章

  1. 【Codeforces Round #438 C】 Qualification Rounds

    [链接]h在这里写链接 [题意] 给你n个问题,每个人都知道一些问题. 然后让你选择一些问题,使得每个人知道的问题的数量,不超过这些问题的数量的一半. [题解] 想法题. 只要有两个问题. 这两个问题 ...

  2. 【Codeforces Round #438 A】Bark to Unlock

    [链接]h在这里写链接 [题意] 在这里写题意 [题解] 枚举它是在连接处,还是就是整个字符串就好. [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/stdc+ ...

  3. 【Codeforces Round 438 A B C D 四个题】

    题目所在比赛的地址在这里呀 A. Bark to Unlock ·述大意:       输入一个目标串.然后输入n(1<=n<=100)个串,询问是否可以通过这些串收尾相接或者它本身拼出目 ...

  4. Codeforces Round #438 (Div.1+Div.2) 总结

    本来兴致勃勃的想乘着这一次上紫,于是很早很早的到了机房 但是好像并没有什么用,反而rating-=47 Codeforces Round #438(Div.1+Div.2) 今天就这样匆匆的总结一下, ...

  5. 【Codeforces #312 div2 A】Lala Land and Apple Trees

    # [Codeforces #312 div2 A]Lala Land and Apple Trees 首先,此题的大意是在一条坐标轴上,有\(n\)个点,每个点的权值为\(a_{i}\),第一次从原 ...

  6. 【Codeforces Round 431 (Div. 2) A B C D E五个题】

    先给出比赛地址啦,感觉这场比赛思维考察非常灵活而美妙. A. Odds and Ends ·述大意:      输入n(n<=100)表示长度为n的序列,接下来输入这个序列.询问是否可以将序列划 ...

  7. 【Codeforces Round】 #432 (Div. 2) 题解

    Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)  A. Arpa and a research in Mexi ...

  8. 【Codeforces Round】 #431 (Div. 2) 题解

    Codeforces Round #431 (Div. 2)  A. Odds and Ends time limit per test 1 second memory limit per test ...

  9. 【Codeforces Round 1137】Codeforces #545 (Div. 1)

    Codeforces Round 1137 这场比赛做了\(A\).\(B\),排名\(376\). 主要是\(A\)题做的时间又长又交了两次\(wa4\)的. 这两次错误的提交是因为我第一开始想的求 ...

随机推荐

  1. 重新启动IIS不重启电脑

      有时候我们在WEB程序如:ASP,中无意中使用到了一个死循环,或者在测试 DLL组件时,挂了.这时候IIS就停止了响应,我们要继续我们的工作啊,重启IIS服务吧. 然而这个进程还在执行,Inter ...

  2. XAMPP简介

    XAMPP是一款开源.免费的网络服务器软件,经过简单安装后,就可以在个人电脑上搭建服务器环境.本文为大家介绍Windows中安装XAMPP(Apache+Mysql+PHP)及使用方法及其相关问题的总 ...

  3. 【hdu 6214】Smallest Minimum Cut

    [链接] 我是链接,点我呀:) [题意] 求最小割中最少的边数. [题解] 模板题 [代码] const int INF = 1e9; const int maxn = 1e3 + 7; const ...

  4. Css fixed和absolute定位差别

    fixed:固定定位 absolute:绝对定位 差别非常easy: 1.没有滚动栏的情况下没有差异 2.在有滚动栏的情况下.fixed定位不会随滚动栏移动而移动.而absolute则会随滚动栏移动 ...

  5. 11995 - I Can Guess the Data

    大意:猜数据结构是栈.队列或者优先队列,可能为两种以上,也可能都不是. 水题.. STL 记得判断是否为空 #include<iostream> #include<cstdio> ...

  6. 【Codeforces Round #440 (Div. 2) C】 Maximum splitting

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 肯定用尽量多的4最好. 然后对4取模的结果 为0,1,2,3分类讨论即可 [代码] #include <bits/stdc++ ...

  7. 10、bitmap格式分析

    说到图片,位图(Bitmap)当然是最简单的,它Windows显示图片的基本格式,其文件扩展名为*.BMP.在Windows下,任何各式的图片文件(包括视频播放)都要转化为位图个时候才能显示出来,各种 ...

  8. Windows平台CUDA开发之前的准备工作

    CUDA是NVIDIA的GPU开发工具,眼下在大规模并行计算领域有着广泛应用. windows平台上面的CUDA开发之前.最好去NVIDIA官网查看说明,然后下载对应的driver. ToolKits ...

  9. stm32的ADC规则组通道采样顺序设置

    先看一下固件库手册 再看一下手册上的例子:  有两个通道,,并且顺序如下

  10. ios开发网络学习:一:NSURLConnection发送GET,POST请求

    #import "ViewController.h" @interface ViewController ()<NSURLConnectionDataDelegate> ...