题解
其实也不能算是数据处理题 |
---|
毕竟数据量很小 |
我用了map存 |
因为我觉得map带的排序很好用 |
主要是这个题的数据量不大,随便搞啊 |
距离原点的距离对应id,距离自动排序 |
Code
#include <iostream>
#include <map>
#include <cmath>
using namespace std;
double f(int x, int y)
{
return sqrt(x * x + y * y);
}
int main()
{
int N, x, y;
string id;
cin >> N;
map<double, string> rap;
while (N--)
{
cin >> id >> x >> y;
rap[f(x, y)] = id;
}
// cout<<rap.begin()->second<<' '<<rap.rbegin()->second;
for (auto i = rap.rbegin();; i--)
{
break;
cout << i->second << endl;
}
return 0;
}