Untitled
raw download clone
TEXT
views 30
,
size 932 b
#include<iostream>
#include<cmath>
using namespace std;
struct punct
{
    float x,y;
};
struct segm
{
    punct dr,st;
    float l;
}v[101];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i].dr.x>>v[i].dr.y>>v[i].st.x>>v[i].st.y;
        v[i].l=sqrt((v[i].st.x-v[i].dr.x)*(v[i].st.x-v[i].dr.x)+(v[i].st.y-v[i].dr.y)*(v[i].st.y-v[i].dr.y));

    }
    float smax=v[1].l,smin=v[1].l;
    for(int i=2;i<=n;i++)
    {
        if(v[i].l>smax)
            smax=v[i].l;
        if(v[i].l<smin)
            smin=v[i].l;
    }
    cout<<smax<<' '<<smin<<endl;
    for(int i=1;i<=n;i++)
    {
        if(v[i].l==smax)
            cout<<v[i].dr.x<<' '<<v[i].dr.y<<" - "<<v[i].st.x<<' '<<v[i].st.y<<endl;

    }
    for(int i=1;i<=n;i++)
    {
        if(v[i].l==smin)
            cout<<v[i].dr.x<<' '<<v[i].dr.y<<" - "<<v[i].st.x<<' '<<v[i].st.y<<endl;

    }
}
close fullscreen
Login or Register to edit or fork this paste. It's free.