11455 - Behold my quadrangle

All about problems in Volume 114. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

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

Re: 11455 - Behold My Quadrangle

Post by reza_cse08 » Fri Nov 22, 2013 8:34 pm

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

Post by reza_cse08 » Fri Nov 22, 2013 8:34 pm

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.

User avatar
Zyaad Jaunnoo
Experienced poster
Posts: 120
Joined: Tue Apr 16, 2002 10:07 am

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

Post by Zyaad Jaunnoo » Thu Oct 02, 2014 5:45 pm

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.

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

Re: 11455 - Behold my quadrangle

Post by lighted » Fri Oct 03, 2014 11:35 am

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

Post by ssavi » Fri Nov 21, 2014 2:58 pm

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

Post by mirukukafe » Sun Oct 16, 2016 4:31 pm

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");
		}
	}
	
}

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

Re: 11455 - Behold my quadrangle

Post by lighted » Fri Mar 10, 2017 2:32 pm

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

Post Reply

Return to “Volume 114 (11400-11499)”

Who is online

Users browsing this forum: No registered users and 1 guest