B. Race Against Time

链接:点击打开链接

思路: .... 原来秒对时针的角度也有影响...

#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
#define debug puts
#define setp cout << fixed << setprecision(15)
#define fst ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=2e5+5;
typedef long long ll;

set<double> st;

int main(void){
    fst;
    int h,m,s,t1,t2;
    cin >> h >> m >> s>>t1>>t2;
    double a=h*30+1.0*m*30/60+30*1.0/3600*s;
    double b=6*m+0.1*s;
    double c=1.0*6*s;
//    cout << a <<endl;
//    printf("%.10f\n",a);
//    cout << b <<endl;
//    cout << c <<endl;
    st.insert(a);
    st.insert(c);
    st.insert(b);
    if(t1<t2)   swap(t1,t2);
    t1*=30,t2*=30;
    int f=1;
    for(auto te:st){
        if(te>t2&&te<t1){
            f=0;
//            cout <<"te="<<te<<endl;
            break;
        }
    }
    if(f){
        cout <<"YES"<<endl;
        return 0;
    }

    f=1;
    for(auto te:st){
        if(te>t1&&te>t2||te<t1&&te<t2){
            f=0;
            break;
        }
    }
    if(f){
        cout <<"YES"<<endl;
        return 0;
    }
    cout <<"NO"<<endl;
    return 0;
}
/**********
3 0 30 3 4
**********/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值