Page 2 of 2

Re: 11455 - Behold My Quadrangle

Posted: Fri Nov 22, 2013 8:34 pm
by reza_cse08
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.

Re: 11455 - Behold My Quadrangle

Posted: Fri Nov 22, 2013 8:34 pm
by reza_cse08
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.

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

Posted: Thu Oct 02, 2014 5:45 pm
by Zyaad Jaunnoo
sazzadcsedu wrote:BEWARE!!!!!!!!!!!!!1

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.

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

Posted: Fri Oct 03, 2014 11:35 am
by lighted
I submitted my accepted program with checking zeroes and making infinite loop in that case. Got accepted again. Input don't contain zeroes. :)

Re: 11455 - Behold my quadrangle

Posted: Fri Nov 21, 2014 2:58 pm
by ssavi
Got Ac./

Re: 11455 - Behold my quadrangle

Posted: Sun Oct 16, 2016 4:31 pm
by mirukukafe
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

Posted: Fri Mar 10, 2017 2:32 pm
by lighted
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.