Untitled
raw download clone
CPP
views 34
,
size 839 b
#include <iostream>
using namespace std;

struct punct
{
    int x, y;
};

struct segment
{
    punct a, b;
    float lung;
}v[101];

int main ()
{
    int n;
    cin >> n;
    
    cin >> v[1].a.x >> v[1].a.y >> v[1].b.x >> v[1].b.y;
    v[1].lung = sqrt((v[1].a.x - v[1].b.x) * (v[1].a.x - v[1].b.x) +
                         (v[1]a.y - v[1].b.y) * (v[1].a.y - v[1].b.y));
    float maxi, mini;
    maxi = mini = v[1].lung;
    
    for(int i = 2; i <= n; i++)
    {
        cin >> v[i].a.x >> v[i].a.y >> v[i].b.x >> v[i].b.y;
        v[i].lung = sqrt((v[i].a.x - v[i].b.x) * (v[i].a.x - v[i].b.x) +
                         (v[i].a.y - v[i].b.y) * (v[i].a.y - v[i].b.y));
        if(maxi < v[i].lung)
            maxi = v[i].lung;
        if(mini > v[i].lung)
            mini = v[i].lung;
    }
}
close fullscreen
Login or Register to edit or fork this paste. It's free.