UVA 11455 - Behold my quadrangle











#include <bits/stdc++.h>
using namespace std;
int main()
{


    long long int t,a,b,c,d,i,j,s1,s2,s3,s4;
    //freopen("11455.txt","r",stdin);
    //freopen("11455out.txt","w",stdout);
    cin>>t;
    for(i=1;i<=t;i++)
    {
        cin>>a>>b>>c>>d;
        s1=a+b+c;
        s2=b+c+d;
        s3=a+c+d;
        s4=a+b+d;

        if(a==b && a==c && a==d)
        {

            cout<<"square"<<endl;

        }
        else if((a==b && c==d)|| (a==c && b==d) ||(a==d && b==c))
        {
             cout<<"rectangle"<<endl;
        }
        else if(s1>d && s2>a && s3>b && s4>c)
        {
            cout<<"quadrangle"<<endl;
        }
        else
        {
             cout<<"banana"<<endl;
        }

    }
    return 0;
}

Download Coding Interview Book and Get More Tutorials for Coding and Interview Solution: Click Here

Download System Design Interview Book and Get More Tutorials and Interview Solution: Click Here

Do you need more Guidance or Help? Then Book 1:1 Quick Call with Me: Click Here

Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment