【链接】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. Redo 非current损坏

    Redo log 文件损坏或丢失,在启动数据库时在alert日志中会有如下错误: ORA-00313: open failed for members of log group 1 of thread ...

  2. python3 求斐波那契数列(Fibonacci sequence)

    输出斐波那契数列的前多少个数. 利用函数 #!/usr/bin/env python # -*- coding:utf-8 -*- # Author:Hiuhung Wan # ----斐波那契数列( ...

  3. js闭包作用(避免使用全局变量)

    js闭包作用(避免使用全局变量) 一.总结 1.优点::可以把局部变量驻留在内存中,可以避免使用全局变量; 2.缺点:也有占用更多内存的缺点,用完要及时让垃圾回收器回收  fn=null //应及时解 ...

  4. “-bash: !”: event not found"、echo > sudo permission denied

    1. "-bash: !": event not found" 比如当我们在 linux 命令行输入echo "Reboot your instance!&qu ...

  5. MongoDb 查询时常用方法

    Query.All("name", "a", "b");//通过多个元素来匹配数组Query.And(Query.EQ("name ...

  6. java回调函数这样说,应该明确了吧!

    有哥们问我回调怎么用,回调怎么理解? 怎么说好呢,仅仅可意会不可言传呐,非也,回调在实际开发中使用频率事实上是非常高的,恰好我小时候也被回调函数欺负过,居然问了,那么肯定要好好分享一下我的一些经验. ...

  7. Python 奇葩语法

    a = 1, 2, 3 赋值后的结果,a == (1, 2, 3),将一个元组(tuple)赋给了变量 a (1, 2) + (3, ) ⇒ (1, 2, 3),并不能说明 tuple 可以添加新的元 ...

  8. 菜单之二:使用xml文件定义菜单 分类: H1_ANDROID 2013-11-03 09:39 1038人阅读 评论(0) 收藏

    参考<疯狂android讲义>2.10节 P174,参见归档project:XmlMenuDemo.zip 一般推荐使用XML文件定义菜单. 基本步骤如下: 1.定义布局文件 为简单显示原 ...

  9. iOS View自定义窍门——UIButton实现上显示图片,下显示文字

    “UIButton实现上显示图片,下显示文字”这个需求相信大家在开发中都或多或少会遇见.比如自定义分享View的时候.当然,也可以封装一个item,上边imageView,下边一个label.但是既然 ...

  10. js进阶 11-16 jquery如何查找元素的父亲、祖先和子代、后代

    js进阶 11-16 jquery如何查找元素的父亲.祖先和子代.后代 一.总结 一句话总结:过滤或者查找的方法里面可以带参数进行进一步的选择. 1.parent()和parents()方法的区别是什 ...