Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
592 B
0
Indexable
Never
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

struct p
{
    int x;
    int y;
    float r;
};

bool comp(p &a, p &b)
{
    if (a.r > b.r) return 1;
    return 0;
}

int main()
{
    int n;
    cin >> n;

    vector <p> vectorrr(n);

    for (int i = 0; i < n; i++)
    {
        cin >> vectorrr[i].x >> vectorrr[i].y;
        vectorrr[i].r = sqrt(vectorrr[i].x * vectorrr[i].x + vectorrr[i].y * vectorrr[i].y);
    }
    sort(vectorrr.begin(), vectorrr.end(), comp);
}