UVA solution 11455 – Behold my quadrangle

Editorial:
we need to read those :
https://en.wikipedia.org/wiki/Quadrilateral
https://www.mathsisfun.com/quadrilaterals.html

And one thing to be remebered that to be a quadrangle we have to follow this condition:
a+b+c+d=360
so a<=b+c+d  && b<=a+c+d && c<=b+c+d

and for square every side is same and for rectangle opposite side is same

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int test_case,a,b,c,d,i;
    while((scanf("%d",&test_case)==1))
    {
        for(i=0; i<test_case; i++)
        {
            scanf("%d %d %d %d",&a,&b,&c,&d);
            if(a==b && b==c && c==d && d==a)
            {
                printf("square\n");
            }
            else if((a==c && b==d)||(a==b && c==d)||(b==c && a==d))
            {
                printf("rectangle\n");
            }
            else if(a<=b+c+d && b<=a+c+d && c<=a+b+d && d<=a+b+c)
            {
                printf("quadrangle\n");
            }
            else
            {
                printf("banana\n");
            }
        }
    }

    return 0;
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *