CodeForces

来源:互联网 发布:康佳网络电视售后电话 编辑:程序博客网 时间:2024/04/29 20:39

m,s 向下  /5 判断区间的话好像有精度问题一直wa8

只能把h,t1,t2 向上  *5 判断经过的指针的数量, 数量为3或0都OK。

#include <bits/stdc++.h>using namespace std;int a[111];int h,m,s,t1,t2;int main(){    cin >> h >> m >> s >>t1 >> t2;    h *= 5; t1 *= 5; t2 *= 5;    a[h] ++; a[m] ++; a[s] ++;    if(t1 > t2) swap(t1,t2);    int k = 0;    for(int i = t1 ; i < t2 ;i++)    {        k+=a[i];    }    if(!k || k==3)cout <<"yes" << endl;    else cout << "NO" <<endl;}


原创粉丝点击