UVA 11455 (Behold My Quadrangle) Solution

Solve in C:

#include<stdio.h>
#include<math.h>
int main ()
{

    long long int n,a,b,c,d,i;
    while(scanf("%lld",&n)!=EOF)
    {
        for(i=1; i<=n; i++)
        {
            scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
            if(((a==b&&b==c)&&(c==d&&d==a))&&(c==a&&b==d))
                printf("square\n");
            else if((a==c&&b==d)||(b==c&&a==d)||(a==b&&c==d)||(c==d&&d==a))
                printf("rectangle\n");
            else if(((a+b+c>d)&&(b+c+d>a))&&((a+c+d>b)&&(a+b+d>c)))
                printf("quadrangle\n");
            else
                printf("banana\n");
        }
    }
}

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.