【链接】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. 11.5 Android显示系统框架_Vsync机制_代码分析

    5.5 surfaceflinger对vsync的处理buffer状态图画得不错:http://ju.outofmemory.cn/entry/146313 android设备可能连有多个显示器,AP ...

  2. pragma pack,字节对齐

    关于字节对齐 pragma pack 一. 测试代码: // packTest.cpp : Defines the entry point for the console application. / ...

  3. amazeui页面分析4

    amazeui页面分析4 一.总结 1.直接照着作者的设计思路用:例如 pet_hd_con_time pet_hd_con_map ,这是time 和 map,那我别的说不定也可以直接用,比如aut ...

  4. iOS_01_什么是ios

    * ios是一款由苹果公司开发的操作系统(os是Operating Systen的简称),就像平时在电脑上用的Window XP.Window 7.都是操作系统. * 那什么是操作系统呢?操作系统其实 ...

  5. 【Codeforces Round #437 (Div. 2) B】Save the problem!

    [链接]h在这里写链接 [题意]     给你一个金额N,和硬币的类型总数M;     (完全背包),然后问你组成N的方案数.     使得,用这些硬币组成价值为N的金额的方案数为A;     现在A ...

  6. 链表(三)——链表删除冗余结点&amp;插入结点到有序链表

    1.一个以递增方式排列的链表,去掉链表中的冗余值. 思路一:设有两个指针p和q.使p不动,q依次往后循环直到p->data不等于q->data,再将中间的冗余数据删除. 思路二:设有两个指 ...

  7. PBOC

    http://blog.sina.com.cn/s/blog_64cc82620100rcgu.html 最近在做一个基于PBOC电子现金卡的终端应用, 项目还没有完成, 但电子现金部分的处理模块已完 ...

  8. LVS负载均衡+动静分离+高可用(nginx+tomcat+keepalived)

    文章目录 [隐藏] 一.环境介绍 二.环境安装 1.安装JDK 2.两台服务器安装tomcat 3.nginx安装 4.keepalive安装 三.负载均衡 四.动静分离 五.keepalive高可用 ...

  9. 关于spring获取webApplication.getBean多种途径和简单解释

    ApplicationContext ac1 = new FileSystemXmlApplicationContext("com/spark/system/applicationConte ...

  10. js进阶ajax基本用法(创建对象,连接服务器,发送请求,获取服务器传过来的数据)

    js进阶ajax基本用法(创建对象,连接服务器,发送请求,获取服务器传过来的数据) 一.总结 1.ajax的浏览器的window对象的XMLHtmlRequest对象的两个重要方法:open(),se ...