链接:http://www.bnuoj.com/bnuoj/problem_show.php?pid=1013
水题..
用结构体二级排序即可..
#include <iostream>
#include <algorithm>
using namespace std;
typedef struct
{
int num;
int time;
}pro;
pro data[3000];
bool cmp(const pro &a,const pro &b)
{
if(a.time!=b.time)
return a.time<b.time;
else
return a.num<b.num;
}
int main()
{
int n;
int m;
int i;
int j=1;
cin>>n;
while(n--)
{
cin>>m;
for (i=0;i<m;i++)
{
cin>>data[i].time;
data[i].num=i+1;
}
sort(data,data+m,cmp);
cout<<"Case"<<" "<<j<<":";
for (i=0;i<m;i++)
cout<<" "<<data[i].num;
cout<<endl;
j++;
}
return 0;
}