64,654
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <algorithm>
#include <map>
#include <functional>
using namespace std;
bool less(const float & f1, const float & f2)
{
return (f1<f2);
}
int main()
{
map<float,int> m;
int n, i = 1;
float score;
cin >> n;
while(i <= n)
{
cin >> score;
m[score] = i;
i++;
}
sort(m.begin(),m.end(),less);
map<float, int>::iterator iter = m.begin();
while(iter != m.end())
{
cout << iter->first << "\t\t" << iter->second << endl;
iter++;
}
return 0;
}