11479 - Is this the easiest problem?

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

shekhar
New poster
Posts: 6
Joined: Wed Jul 09, 2008 12:34 pm

11479 - Is this the easiest problem?

Post by shekhar » Sun Aug 03, 2008 9:39 pm

I am getting WA in this simple problem.
PLzz help me with some critical inputs.

Code: Select all

GOT ACC
Edit: Title Modified by Moderator.
Last edited by shekhar on Mon Aug 04, 2008 10:41 am, edited 1 time in total.

Leonid
Experienced poster
Posts: 146
Joined: Thu Dec 22, 2005 5:50 pm
Contact:

Re: 11479

Post by Leonid » Sun Aug 03, 2008 9:49 pm

Code: Select all

    long a,b,c,t,count=1;
Try replacing long with long long.
Also I'd suggest to use the "return 0" statement at the end of main function.
And remove system("pause") from the end of your main function.
Everything else seems identical to my solution.
Let me know if it works.

shekhar
New poster
Posts: 6
Joined: Wed Jul 09, 2008 12:34 pm

Re: 11479

Post by shekhar » Mon Aug 04, 2008 10:39 am

Thanks Leonid,
changed long to long long and ACC

User avatar
mrmbdctg
New poster
Posts: 18
Joined: Sun Mar 04, 2007 7:12 am
Location: Bangladesh
Contact:

Re: 11479

Post by mrmbdctg » Mon Aug 04, 2008 12:46 pm

Can any body please clear me the condition of invalid & scalene . I am stuck into here.
Thanks in advance.
Mizanur Rahaman Mizan
USTC, CHITTAGONG
BANGLADESH
Website:http://www.teronga.com

User avatar
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Re: 11479

Post by sohel » Mon Aug 04, 2008 12:55 pm

A triangle is invalid if any side_length <= 0 or (sum of smaller 2 sides <= largest side).
A triangle is scalene if it is valid && all the sides are distinct.

User avatar
newton
Experienced poster
Posts: 162
Joined: Thu Jul 13, 2006 7:07 am
Location: Campus Area. Dhaka.Bangladesh
Contact:

Re: 11479 - Is this the Easiest Problem? but WA!

Post by newton » Sun Aug 31, 2008 9:33 pm

Code: Select all

Removed because Accepted
Last edited by newton on Tue Sep 09, 2008 12:26 am, edited 5 times in total.

User avatar
shamim
A great helper
Posts: 498
Joined: Mon Dec 30, 2002 10:10 am
Location: Bozeman, Montana, USA

Re: 11479 - Is this the Easiest Problem?

Post by shamim » Mon Sep 01, 2008 4:55 pm

The condition for invalid is wrong.

it should be T[0]+T[1] <= T[2].

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 11479 - Is this the Easiest Problem?

Post by Obaida » Mon Nov 10, 2008 8:07 am

How it can be WA????? :o :( :( :( :(

Code: Select all

Sorry for that post
Last edited by Obaida on Mon Nov 10, 2008 10:05 am, edited 2 times in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

User avatar
newton
Experienced poster
Posts: 162
Joined: Thu Jul 13, 2006 7:07 am
Location: Campus Area. Dhaka.Bangladesh
Contact:

Re: 11479 - Is this the Easiest Problem?

Post by newton » Mon Nov 10, 2008 8:29 am

Your code even does not pass the sample input.
What do you mean by

Code: Select all

else if(t1+t2<t3||t1+t3<t2||t2+t3<t1)
         puts("Scalene");

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 11479 - Is this the Easiest Problem?

Post by Obaida » Mon Nov 10, 2008 10:06 am

again sorry. Now please help me.
Last edited by Obaida on Wed Nov 12, 2008 8:57 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

User avatar
newton
Experienced poster
Posts: 162
Joined: Thu Jul 13, 2006 7:07 am
Location: Campus Area. Dhaka.Bangladesh
Contact:

Re: 11479 - Is this the Easiest Problem?

Post by newton » Mon Nov 10, 2008 7:40 pm

What should be the output for:

Code: Select all

1
1 1 2
think you got the point.

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 11479 - Is this the Easiest Problem?

Post by Obaida » Wed Nov 12, 2008 8:56 am

Easy but a bit tricky. :wink:
it make me really angry. would u make a look at this. why it's getting wa!!

Code: Select all

#include<stdio.h>
int main()
{
	long long int n,c=0,t1,t2,t3;
	scanf("%lld",&n);
	while(n--)
	{
		c++;
		scanf("%lld %lld %lld",&t1,&t2,&t3);
		printf("Case %lld: ",c);
		if(t1<=0||t2<=0||t3<=0)
			puts("Invalid");
		else if(t1+t2<=t3||t2+t3<=t1||t1+t3<=t2)
			puts("Invalid");
		else if(t1==t2==t3)
			puts("Equilateral");
		else if(t1==t2||t2==t3||t1==t3)
			puts("Isosceles");
		else
			puts("Scalene");
	}
	return 0;
}
Thank you for your help. newton.
Last edited by Obaida on Wed Nov 12, 2008 9:15 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

User avatar
newton
Experienced poster
Posts: 162
Joined: Thu Jul 13, 2006 7:07 am
Location: Campus Area. Dhaka.Bangladesh
Contact:

Re: 11479 - Is this the Easiest Problem?

Post by newton » Wed Nov 12, 2008 9:05 am

You have declared variables as long int but you are taking input with %lld as long long int.
How can you hope that you will get Accepted.

The problem is really Easy if you think a little before post.

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 11479 - Is this the Easiest Problem?

Post by Obaida » Wed Nov 12, 2008 9:14 am

Sorry for that, long long wasn't compiling in my compiler. i used long long in submission. But still WA.!!!
try_try_try_try_&&&_try@try.com
This may be the address of success.

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 11479 - Is this the Easiest Problem?

Post by Obaida » Sat Nov 15, 2008 11:45 am

I have accepted after 16 submission!!!
But the main thing we need to do is to find the smallest, mid, and the max value. Then do what they want to do. :wink:
This one also helped me.
A triangle is invalid if any side_length <= 0 or (sum of smaller 2 sides <= largest side).
A triangle is scalene if it is valid && all the sides are distinct.
try_try_try_try_&&&_try@try.com
This may be the address of success.

Post Reply

Return to “Volume 114 (11400-11499)”