typedef struct Time
{
int hour, minute;
bool operator<(Time b)
{
if(hour == b.hour)
return minute < b.minute;
return hour < b.hour;
}
bool operator>=(Time b)
{
return !(*this < b);
}
bool operator<=(Time b)
{
return !(b < *this);
}
bool operator==(Time b)
{
return !(b < *this) && !(*this < b);
}
} Time;
typedef struct Flight
{
string id, org, to;
Time beg, ed;
int price;
} Flight;
int cmp(Flight a, Flight b)
{
if(a.beg == b.beg){
if(a.price == b.price){
return a.id < b.id;
}
return a.price < b.price;
}
return a.beg < b.beg;
}
以下代码
> > if(a.beg == b.beg){
> if(a.price == b.price){
> return a.id < b.id;
> }
> return a.price < b.price;
> }
> return a.beg < b.beg;
不等于
if(a.beg == b.beg){
if(a.price == b.price)
return a.id < b.id;
return a.price < b.price;
return a.beg < b.beg;
}
嗯,一个月做一次题,
结果就是他妈的蠢到这份上