ACM (TJU) : 2772


#include <stdio.h>
#include <math.h>

int main ()
{
    double x1, x2, x3, x4;
    double y1, y2, y3, y4;

    int testCase;
    scanf ("%d", &testCase);

    while ( testCase-- ) {

        scanf ("%lf %lf %lf %lf", &x1, &y1, &x3, &y3);
        scanf ("%lf %lf %lf %lf", &x2, &y2, &x4, &y4);

        double length1 = sqrt (pow ((x1 - x4), 2) + pow ((y1 - y4), 2));
        double length2 = sqrt (pow ((x2 - x3), 2) + pow ((y2 - y3), 2));
        double length3 = sqrt (pow ((x1 - x2), 2) + pow ((y1 - y2), 2));
        double length4 = sqrt (pow ((x3 - x4), 2) + pow ((y3 - y4), 2));
        double length5 = sqrt (pow ((x1 - x3), 2) + pow ((y1 - y3), 2));
        double length6 = sqrt (pow ((x2 - x4), 2) + pow ((y2 - y4), 2));

        if (length1 == length2 && length3 == length4 && length5 != length6)
        printf ("Yes\n");
        else
        printf ("No\n");

    }

    return 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s