Untitled
unknown
plain_text
3 years ago
579 B
3
Indexable
#include <iostream>
#include <fstream>
#include <stdint.h>
#include <algorithm>
#include <string>
#include "Header.h"
using namespace std;
struct an {
int a, b;
float c;
};
bool comp(const an& a, const an& b)
{
bool h = a.c > b.c;
return h;
}
int main() {
int a;
int x, y;
cin >> a;
vector<an> mass;
for (int i = 0; i < a; i++){
cin >> x >> y;
an k;
k.a = x;
k.b = y;
k.c = sqrt(x * x + y * y);
mass.push_back(k);
}
sort(mass.begin(), mass.end(), comp);
for (an h : mass) {
cout << h.a << ' ' << h.b << '\n';
}
}Editor is loading...