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 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

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

Powered by Blogger.