Page 2 of 4

Re: 11479 - Is this the Easiest Problem?

Posted: Wed Nov 26, 2008 10:55 pm
by Jorge-ThELaW
How it can be WA????? :

Code: Select all

Removed because accepted!!

Re: 11479 - Is this the Easiest Problem?

Posted: Thu Nov 27, 2008 9:05 am
by shamim
Change the data type from long to long long and you will get AC :wink:

This is due to large values of sides whose sum wont fit in 32 bit signed integer.

Re: 11479 - Is this the Easiest Problem?

Posted: Thu Jul 09, 2009 12:14 am
by lnr
Can anyone give some special input output?
input:

Code: Select all

20
3 6 -1
5 3 5
6 2 9
1 2 7
0 9 3
6 0 6
2 6 1
8 7 9
2 0 2
3 7 5
9 2 2
8 9 7
3 6 1
2 9 3
1 9 4
7 8 4
5 0 3
6 1 0
6 3 2
0 6 1
output:

Code: Select all

Case 1: Invalid
Case 2: Isosceles
Case 3: Invalid
Case 4: Invalid
Case 5: Invalid
Case 6: Invalid
Case 7: Invalid
Case 8: Scalene
Case 9: Invalid
Case 10: Scalene
Case 11: Invalid
Case 12: Scalene
Case 13: Invalid
Case 14: Invalid
Case 15: Invalid
Case 16: Scalene
Case 17: Invalid
Case 18: Invalid
Case 19: Invalid
Case 20: Invalid
Accepted.

11479 pls pls pls help

Posted: Sat Oct 24, 2009 8:13 pm
by shorojini
#include<iostream>
using namespace std;
int main() {

long long a, b, c, n,i;
cin>>n;

for(i=1;i<=n;i++)
{

cin>>a>>b>>c;

if((a<=0||b<=0||c<=0)||((b+c)<=a)||((a+c)<=b)||((a+b)<=c))
cout<<"Case "<<i<<": "<<"Invalid\n";
else
{

if((a==b==c))
cout<<"Case "<<i<<": "<<"Equilateral\n";

else if((a==b)||(b==c)||(c==a))
cout<<"Case "<<i<<": "<<"Isosceles\n";

else
cout<<"Case "<<i<<": "<<"Scalene\n";

}

}
return 0;
}

pls tell me where is the wrong? why it is wrong ans. pls pls pls

Re: 11479 pls pls pls help

Posted: Sat Oct 24, 2009 8:45 pm
by coze
Try the following input:
Input

Code: Select all

1
3 3 3
Output

Code: Select all

Case 1: Equilateral

Code: Select all

if (a == b == c)
is not equal to

Code: Select all

if (a == b && b == c)
Hope it helps.

Re: 11479 pls pls pls help

Posted: Fri Oct 30, 2009 1:03 pm
by shorojini
thanks coz 4 ur great help. i got accepted. i have started acm. and i have no help. will u pls give me ur mail number. so i will be able to share my probs.it is my request.
now , will u just tell me why (a==b==c) is not right. it will be great help.

Re: 11479 - Is this the Easiest Problem?

Posted: Mon Dec 20, 2010 4:48 pm
by wawa

Code: Select all

#include <iostream>
using namespace std;
int main()
{
	long long N, a, b, c;
	cin >> N;
	for (long long i = 0; i < N; i++)
	{
		cin >> a >> b >> c;
		if ((a + b) <= c || (a + c) <= b || (b + c) <= a)
			cout << "Case " << i + 1 << ": Invalid" << endl;
		else if ((a == b) && (a == c))
			cout << "Case " << i + 1 << ": Equilateral" << endl;
		else if ((a == b) || (a == c) || (a == b))
			cout << "Case " << i + 1 << ": Isosceles" << endl;
		else
			cout << "Case " << i + 1 << ": Scalene" << endl;
	}
	return 0;
}
Why is it WA?????? :evil:
plz help...~!!! :-?

Re: 11479 - Is this the Easiest Problem?

Posted: Wed Dec 22, 2010 9:30 am
by asif_iut
else if ((a == b) || (a == c) || (a == b))
what is the difference between the first and the last condition??

Re: 11479 - Is this the Easiest Problem?

Posted: Sat Feb 05, 2011 4:31 pm
by kissu parina
long data type is enough for this problem. :D

Re: 11479 - Is this the Easiest Problem?

Posted: Mon Feb 21, 2011 9:02 am
by hotovaga
Where is the problem in my code? getting WA..
help me pls..

Code: Select all

got AC

Re: 11479 - Is this the Easiest Problem?

Posted: Mon May 30, 2011 1:00 pm
by du_loser
getting wa :cry:

Code: Select all

#include<stdio.h>
int main(){
	long long int c,tc,a[3],i,j,t;
	scanf("%lld",&tc);
	for(c=1;c<=tc;c++){
		scanf("%lld%lld%lld",&a[0],&a[1],&a[2]);
	for(i=0;i<2;i++){
		for(j=0;j<2-i;j++){
			if(a[j]<a[j+1]){
				t=a[j];
				a[j]=a[j+1];
				a[j+1]=t;
			}
		}
	}
	printf("Case %lld: ",c);
	if((a[0]<=(a[1]+a[2]))&&a[0]>0&&a[1]>0&&a[2]>0){
		if(a[0]==a[1]&&a[1]==a[2])
			printf("Equilateral\n");
		else if(a[0]==a[1]||a[1]==a[2]||a[2]==a[0])
			printf("Isosceles\n");
		else
			printf("Scalene\n");
	}
	else printf("Invalid\n");
    }
return 0;
}

Re: 11479 - Is this the Easiest Problem?

Posted: Wed Jun 01, 2011 5:32 pm
by helloneo
Try this case..

Code: Select all

1
1 2 3

My output is..

Code: Select all

Case 1: Invalid

Re: 11479 - Is this the Easiest Problem?

Posted: Wed Jul 27, 2011 11:50 am
by ez0545

Code: Select all

 got acc


can anyone please tell me whats wrong with this code??? I am getting wrong answer every time.

Re: 11479 - Is this the Easiest Problem?

Posted: Thu Dec 08, 2011 4:09 am
by Help Me
What is the problem??? Why it Wrong answer?




#include<stdio.h>
#include<stdlib.h>


int comp(const void *a, const void *b)
{
return (*(long int *)a)-(*(long int *)b);
}



int main()
{
long int t,p,x,y,z,ary[10000],k,temp,max,small,mid,l;
scanf("%ld",&t);
for(p=1;p<=t;p++)
{
scanf("%ld%ld%ld",&x,&y,&z);
ary[1]=x;
ary[2]=y;
ary[3]=z;

qsort(ary,4,sizeof(ary[1]),comp);

small=ary[1];
mid=ary[2];
max=ary[3];
if((small+mid)<=max)
printf("Case %ld: Invalid\n",p);
else if(x==y==z)
printf("Case %ld: Equilateral\n",p);
else if((x==y)||(x==z)||(y==z))
printf("Case %ld: Isosceles\n",p);

else
printf("Case %ld: Scalene\n",p);

}

return 0;
}

Re: 11479 - Is this the Easiest Problem?

Posted: Fri Jan 13, 2012 2:52 am
by brianfry713
You're sorting an array of size 4 that should only be of size 3. Think of what happens with negatives.