Uva 11455 - Behold my quadrangle
#include<bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define x first
#define y second
using namespace std;
typedef long long LL;
typedef vector<int>vi;
typedef vector<long long>vll;
int main()
{
int t,i;
vll v;
cin >> t;
while(t--)
{
v.clear();
for(i=0;i<4;i++)
{
LL x;
cin >> x;
v.push_back(x);
}
sort(all(v));
//for(i=0;i<4;i++)cout << v[i] << " ";
LL mxi = *max_element(all(v));
//cout << mxi;
bool f=false;
for(i=0;i<3;i++)
{
if(v[i] == v[i+1])
{
f=true;
}
else
{
f=false;
break;
}
}
if(f)
{
cout << "square" <<endl;
}
else
{
f=false;
for(i=0;i<4;i+=2)
{
if(v[i]==v[i+1])
{
f=true;
}
else
{
f=false;
break;
}
}
if(f)
{
cout << "rectangle" << endl;
}
else
{
f=false;
LL s=0;
for(i=0;i<3;i++)
{
s+=v[i];
}
if(s > mxi)
{
//cout << "quadrangle" << endl;
f=true;
}
else
{
f=false;
}
if(f)
{
cout << "quadrangle" << endl;
}
else
{
cout << "banana" << endl;
}
}
}
}
return 0;
}
#define all(x) x.begin(),x.end()
#define x first
#define y second
using namespace std;
typedef long long LL;
typedef vector<int>vi;
typedef vector<long long>vll;
int main()
{
int t,i;
vll v;
cin >> t;
while(t--)
{
v.clear();
for(i=0;i<4;i++)
{
LL x;
cin >> x;
v.push_back(x);
}
sort(all(v));
//for(i=0;i<4;i++)cout << v[i] << " ";
LL mxi = *max_element(all(v));
//cout << mxi;
bool f=false;
for(i=0;i<3;i++)
{
if(v[i] == v[i+1])
{
f=true;
}
else
{
f=false;
break;
}
}
if(f)
{
cout << "square" <<endl;
}
else
{
f=false;
for(i=0;i<4;i+=2)
{
if(v[i]==v[i+1])
{
f=true;
}
else
{
f=false;
break;
}
}
if(f)
{
cout << "rectangle" << endl;
}
else
{
f=false;
LL s=0;
for(i=0;i<3;i++)
{
s+=v[i];
}
if(s > mxi)
{
//cout << "quadrangle" << endl;
f=true;
}
else
{
f=false;
}
if(f)
{
cout << "quadrangle" << endl;
}
else
{
cout << "banana" << endl;
}
}
}
}
return 0;
}
Comments
Post a Comment