ACM (UVa) : 11479


Data type:
long long integer

Algorithm:
After taking the input, firstly sort the values, such X <= Y <= Z
if ( X + Y <= Z ) then print (Invalid) // Sum of two smaller sides is greater than larger sides.

Else if (X = Y and X = Z ) then print (Equilateral) // Equilateral, if all three sides r same in value

Else if (X = Y or X = Z or Y = Z ) then print (Isosceles) // Isosceles, if any two sides r same in value

Else if (X !=Y and Y != Z and X !=Z ) then print (Scalene) // Scalene, if all three sides r distinct

Critical input:
4
100 200 300
500 501 502
1000000000 1000000001 1000000002
963 852 741

Critical output:
Case 1: Invalid
Case 2: Scalene
Case 3: Scalene
Case 4: Scalene

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s