问一个 pair 用sort排序的问题
程序代码:pair<int,int>st[100],sd[100];
typedef pair<int,int>P;
int cmp(P a, P b)
{
if(a.second!=b.second)return a.second<b.second;
if(a.first!=b.first)return a.first>b.first;
}主函数里sort(st,st+n,cmp);这么写对吗?
程序代码:pair<int,int>st[100],sd[100];
typedef pair<int,int>P;
int cmp(P a, P b)
{
if(a.second!=b.second)return a.second<b.second;
if(a.first!=b.first)return a.first>b.first;
}主函数里sort(st,st+n,cmp);这么写对吗?
2015-08-23 17:02
程序代码:int cmp(const P &a, const P&b)
{
if(a.second!=b.second)return a.second<b.second;
if(a.first!=b.first)return a.first>b.first;
}
2015-08-23 17:03
2015-08-23 22:54
2015-08-24 08:28
2015-08-24 08:58