Codeforces Round #438
来源:互联网 发布:西服 知乎 编辑:程序博客网 时间:2024/06/08 05:01
题意:
给你一个钟的时间,即给你指针的位置,给你t1时和t2时,让你判断从前到后或者从后到前能不能不碰到指针。
POINT:
把12个刻度之间都增加一个刻度,这样指针如果偏了,就直接当作指在中间。因为判断是从一个正数到另一个正数,所以只要知道有没有偏就行了。
#include <iostream>#include <string.h>#include <stdio.h>#include <vector>#include <algorithm>using namespace std;#define LL long longconst int maxn = 100100;int flag[maxn];int main(){ int h,m,s,t1,t2; cin>>h>>m>>s>>t1>>t2; if(h==12) h=0; if(t1==12) t1=0; if(t2==12) t2=0; if(m!=0||s!=0) flag[h*2+1]++; else flag[h*2]++; int cnt=m/5; if(m%5==0&&s==0) flag[cnt*2]++; else flag[cnt*2+1]++; cnt=s/5; if(s%5==0) flag[cnt*2]++; else flag[cnt*2+1]++; t1=t1*2; t2=t2*2; if(t1>t2) swap(t1, t2); int ans=0; for(int i=t1;i<=t2;i++){ ans+=flag[i]; } if(ans==0||ans==3){ printf("YES\n"); } else printf("NO\n");}
阅读全文
0 0
- Codeforces Round #438 题解
- Codeforces Round #438 题解
- Codeforces Round #438 B
- Codeforces Round #438
- Codeforces Round #438
- Codeforces Round #438
- Codeforces Round #438
- 【codeforces】Codeforces Round #363
- Codeforces Round #438 C. Qualification Rounds
- Codeforces Round #438 868A/B/C
- Codeforces Round #438 C. Qualification Rounds 二进制
- Codeforces Round #438 A. Bark to Unlock
- Codeforces Round #438 B. Race Against Time
- codeforces round #438 C. Qualification Rounds
- Codeforces Round #438 C. Qualification Rounds 题解
- Codeforces Round #438 C. Qualification Rounds
- Codeforces Round #270 Codeforces Round #270
- 【Codeforces】Codeforces Round #271 div2
- python中的字典详细介绍
- 实验二线性表综合实验
- MarkDown编辑器的使用
- UVA
- 全局变量与局部变量
- Codeforces Round #438
- 【JAVASE_学习笔记】类与对象
- WEB_03_JavaScript_第三讲
- Apktool重打包Apk详细介绍
- Recent advances in parallel imaging for MRI
- HDFS的设计和架构
- Java解析XML(一) 使用DOM读取XML文件
- 【C++】 C++11新特性
- svn 搭建笔记