11479 - Is this the easiest problem?

Moderator: Board moderators

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

11479 - Is this the easiest problem?

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

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

Thanks Leonid,
changed long to long long and ACC
mrmbdctg
New poster
Posts: 18
Joined: Sun Mar 04, 2007 7:12 am
Contact:

Re: 11479

Can any body please clear me the condition of invalid & scalene . I am stuck into here.
Mizanur Rahaman Mizan
USTC, CHITTAGONG
Website:http://www.teronga.com
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Re: 11479

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.
newton
Experienced poster
Posts: 162
Joined: Thu Jul 13, 2006 7:07 am
Contact:

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

Code: Select all

Removed because Accepted
Last edited by newton on Tue Sep 09, 2008 12:26 am, edited 5 times in total.
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?

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

Re: 11479 - Is this the Easiest Problem?

How it can be WA?????

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.
newton
Experienced poster
Posts: 162
Joined: Thu Jul 13, 2006 7:07 am
Contact:

Re: 11479 - Is this the Easiest Problem?

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

Re: 11479 - Is this the Easiest Problem?

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.
newton
Experienced poster
Posts: 162
Joined: Thu Jul 13, 2006 7:07 am
Contact:

Re: 11479 - Is this the Easiest Problem?

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

Re: 11479 - Is this the Easiest Problem?

Easy but a bit tricky.
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.
newton
Experienced poster
Posts: 162
Joined: Thu Jul 13, 2006 7:07 am
Contact:

Re: 11479 - Is this the Easiest Problem?

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

Re: 11479 - Is this the Easiest Problem?

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