## 11455 - Behold my quadrangle

Moderator: Board moderators

reza_cse08
New poster
Posts: 8
Joined: Sun Nov 17, 2013 9:55 pm

### Re: 11455 - Behold My Quadrangle

First sort the value then check it.
"Do not think think about the property (a+b+c)>d(for this problem) only check (a+b+c)>=d. although it can not make a quadrangle"

For this problem the uvatoolkit also give the wrong answer.

reza_cse08
New poster
Posts: 8
Joined: Sun Nov 17, 2013 9:55 pm

### Re: 11455 - Behold My Quadrangle

reza_cse08 wrote:First sort the value then check it.
"Do not think think about the property (a+b+c)>d(for this problem) only check (a+b+c)>=d. although it can not make a quadrangle"

For this problem the uvatoolkit also give the wrong answer.

Experienced poster
Posts: 122
Joined: Tue Apr 16, 2002 10:07 am

### Re: beware???-11455 - Behold My Quadrangle

INPUT MAY CONTAIN 0;
ALTHOUGH PROBLEM STATEMENT SAYS
For each test case, there is a line with four positive integer numbers
I WASTE AT LEAST 10 SUBMISSION FOR THIS REASON.
I don't think there are test cases with a side = 0, but there is no harm checking it afterall.
I submitted 2 versions, one considering a side can be 0 and the other one ignoring this fact. Both were accepted.

The answer is a "banana" if the longest side >= the sum of the 3 smallest sides.

1) store the 4 values in an array / vector.
2) Sort the array
3) Then determing the shape you can form.

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 11455 - Behold my quadrangle

I submitted my accepted program with checking zeroes and making infinite loop in that case. Got accepted again. Input don't contain zeroes.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

ssavi
New poster
Posts: 28
Joined: Thu Nov 20, 2014 9:57 pm

### Re: 11455 - Behold my quadrangle

Got Ac./
I know I am a Failure Guy .

mirukukafe
New poster
Posts: 2
Joined: Sun Oct 16, 2016 4:26 pm

### Re: 11455 - Behold my quadrangle

why WA ? help :|

Code: Select all

``````#include<stdio.h>

int main(){
int t,a,b,c,d,temp;

scanf("%d", &t); getchar();
for(int i=0;i<t;i++){
scanf("%d %d %d %d", &a,&b,&c,&d); getchar();
if((a>b && a>c && a>d)){
temp=d+b+c;
if(a<temp){
}
else{
printf("banana\n");
}
}
else if(b>a && b>c && b>d){
temp=d+a+c;
if(b<temp){
}
else{
printf("banana\n");
}
}
else if(c>a && c>b && c>d){
temp=d+a+b;
if(c<temp){
}
else{
printf("banana\n");
}
}
else if(d>a && d>b && d>c){
temp=c+a+b;
if(d<temp){
}
else{
printf("banana\n");
}
}
else if((a==b && c==d) || (a==c && b==d) || (a==d && b==c)){
if(a==b && a==c && a==d){
printf("square\n");
}
else{
printf("rectangle\n");
}
}

else{
printf("banana\n");
}
}

}
``````

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 11455 - Behold my quadrangle

Your code doesn't pass input on uDebug. https://www.udebug.com/UVa/11455

Among 666 cases on uDebug 598th case is

Code: Select all

``````1
87 7 116 22
``````
Judge doesn't contain such input.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman