这个题不难但是里面有很多东西需要注意,尤其是Ties are broken in such a way that an earlier time precedes a later time.这就是说当夹角一样时,事件小的放在前面。
比较麻烦啊。
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;
struct node{
string ko;
int shi;
int fen;
double angle;
};
bool cmp(node a,node b)
{
if(a.angle!=b.angle)
return a.angle<b.angle;
else if(a.shi!=b.shi)
return a.shi<b.shi;
else return a.fen<b.fen;
}
node fuck[6];
int main()
{
int T,i;
string a;
cin>>T;
while(T!=0)
{
for(i=1;i<=5;i++)
{
cin>>a;
fuck[i].ko=a;
fuck[i].shi=(a[0]-'0')*10+(a[1]-'0');
fuck[i].fen=(a[3]-'0')*10+(a[4]-'0');
}
for(i=1;i<=5;i++)
{
fuck[i].angle=abs(fuck[i].fen*6-(fuck[i].shi%12)*30-fuck[i].fen*0.5);
if(fuck[i].angle>180)
fuck[i].angle=360.0-fuck[i].angle;
}
sort(fuck+1,fuck+5+1,cmp);
cout<<fuck[3].ko<<endl;
T=T-1;
}
return 0;
}