Page 1 of 4

11479 - Is this the easiest problem?

Posted: Sun Aug 03, 2008 9:39 pm
by shekhar
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.

Re: 11479

Posted: Sun Aug 03, 2008 9:49 pm
by Leonid

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.

Re: 11479

Posted: Mon Aug 04, 2008 10:39 am
by shekhar
Thanks Leonid,
changed long to long long and ACC

Re: 11479

Posted: Mon Aug 04, 2008 12:46 pm
by mrmbdctg
Can any body please clear me the condition of invalid & scalene . I am stuck into here.
Thanks in advance.

Re: 11479

Posted: Mon Aug 04, 2008 12:55 pm
by sohel
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.

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

Posted: Sun Aug 31, 2008 9:33 pm
by newton

Code: Select all

Removed because Accepted

Re: 11479 - Is this the Easiest Problem?

Posted: Mon Sep 01, 2008 4:55 pm
by shamim
The condition for invalid is wrong.

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

Re: 11479 - Is this the Easiest Problem?

Posted: Mon Nov 10, 2008 8:07 am
by Obaida
How it can be WA????? :o :( :( :( :(

Code: Select all

Sorry for that post

Re: 11479 - Is this the Easiest Problem?

Posted: Mon Nov 10, 2008 8:29 am
by newton
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");

Re: 11479 - Is this the Easiest Problem?

Posted: Mon Nov 10, 2008 10:06 am
by Obaida
again sorry. Now please help me.

Re: 11479 - Is this the Easiest Problem?

Posted: Mon Nov 10, 2008 7:40 pm
by newton
What should be the output for:

Code: Select all

1
1 1 2
think you got the point.

Re: 11479 - Is this the Easiest Problem?

Posted: Wed Nov 12, 2008 8:56 am
by Obaida
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.

Re: 11479 - Is this the Easiest Problem?

Posted: Wed Nov 12, 2008 9:05 am
by newton
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.

Re: 11479 - Is this the Easiest Problem?

Posted: Wed Nov 12, 2008 9:14 am
by Obaida
Sorry for that, long long wasn't compiling in my compiler. i used long long in submission. But still WA.!!!

Re: 11479 - Is this the Easiest Problem?

Posted: Sat Nov 15, 2008 11:45 am
by Obaida
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.