告诉你实际的时间,问你在实际的机械表盘上 两点是否可以不跨越指针到达?(起点终点不在指针上,ac之后知道的)
解:得到double 数据之后排序,圆周相邻即可
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define en '\n'
int rd(){
int tt;scanf("%d",&tt);return tt;
}
int h,m,s,t1,t2;
const int mo=60;
const int maxn=1e2+10;
bool vis[maxn];
bool yes=0;
bool ok(int x){
return !vis[x] and x!=h and x!=m and x!=s;
}
void dfs(int x){
vis[x]=1;
int shang=((x-1)+mo)%mo;
int xia=((x+1)%mo);
if(shang==t2 or xia==t2){
yes=1;
return ;
}
if(ok(shang))dfs(shang);
if(ok(xia))dfs(xia);
}
struct node{
double val,ind;
};
bool cmp(node a,node b){
return a.val<b.val;
}
vector<node>vec;
signed main(){
#ifdef swt
freopen("input2.txt","r",stdin);
#endif // swt
cin>>h>>m>>s>>t1>>t2;
h=(h%12)*5;
t1=((t1)%12)*5;
t2=((t2)%12)*5;
if(t1==t2){cout<<"YES"<<en;return 0;}
double ss=s;
double mm=m+(ss/60);
double hh=h+(mm/60);
vec.pb((node){ss,0}),vec.pb((node){mm,0}),vec.pb((node){hh,0});
double tt1=t1,tt2=t2;
if(tt1>tt2)swap(tt1,tt2);
vec.pb((node){tt1,1});
vec.pb((node){tt2,2});
sort(vec.begin(),vec.end(),cmp);
if(vec[0].ind==1 and vec[vec.size()-1].ind==2){
cout<<"YES"<<en;return 0;
}
for(int i=1;i<vec.size();i++){
if(vec[i].ind==2 and vec[i-1].ind==1){
cout<<"YES"<<en;return 0;
}
}
cout<<"NO"<<en;
return 0;
}