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.
11455 - Behold my quadrangle
Moderator: Board moderators
-
- New poster
- Posts: 8
- Joined: Sun Nov 17, 2013 9:55 pm
-
- 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
I don't think there are test cases with a side = 0, but there is no harm checking it afterall.sazzadcsedu wrote:BEWARE!!!!!!!!!!!!!1
INPUT MAY CONTAIN 0;
ALTHOUGH PROBLEM STATEMENT SAYSI WASTE AT LEAST 10 SUBMISSION FOR THIS REASON.For each test case, there is a line with four positive integer numbers
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.
To simplify your code:
1) store the 4 values in an array / vector.
2) Sort the array
3) Then determing the shape you can form.
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
-
- 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){
printf("quadrangle\n");
}
else{
printf("banana\n");
}
}
else if(b>a && b>c && b>d){
temp=d+a+c;
if(b<temp){
printf("quadrangle\n");
}
else{
printf("banana\n");
}
}
else if(c>a && c>b && c>d){
temp=d+a+b;
if(c<temp){
printf("quadrangle\n");
}
else{
printf("banana\n");
}
}
else if(d>a && d>b && d>c){
temp=c+a+b;
if(d<temp){
printf("quadrangle\n");
}
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");
}
}
}
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 isJudge doesn't contain such input.
Among 666 cases on uDebug 598th case is
Code: Select all
1
87 7 116 22
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman