View Code of Problem 67

#include <stdio.h>

int main(void)
{
    int arr[4][2];
    while(scanf("%d%d%d%d",&arr[0][0],&arr[0][1],&arr[1][0],&arr[1][1]) != EOF)
    {
        scanf("%d%d%d%d",&arr[2][0],&arr[2][1],&arr[3][0],&arr[3][1]);
        int nt[2],mt[2];
        nt[0] = arr[1][0] - arr[0][0];
        nt[1] = arr[1][1] - arr[0][1];
        mt[0] = arr[3][0] - arr[2][0];
        mt[1] = arr[3][1] - arr[2][1];
        if((!nt[0] && nt[0] == mt[0]) || (!nt[1] && nt[1] == mt[1]))
        {
            if((!nt[0] && nt[0] == mt[0] && arr[2][0] == arr[1][0]) || (!nt[1] && nt[1] == mt[1] && arr[2][1] == arr[1][1]))
                printf("Yes\n");
            else
                printf("No\n");
        }
        else
        {
            int k;
            if((k = (1.0 * nt[0] / nt[1])) == 1.0 * mt[0] / mt[1])
            {
                if(arr[1][1] - 1.0 / k * arr[1][0] == arr[2][1] - 1.0 / k * arr[2][0])
                    printf("Yes\n");
                else
                    printf("No\n");
            }
            else
                printf("Yes\n");
        }
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 67