UVa 11479

From Algorithmist
Jump to navigation Jump to search

11479 - Is this the easiest problem?[edit]

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2474

Summary[edit]

Check if three supposed triangle sides compose a valid triangle and if it does, say what type of triangle it forms.

Explanation[edit]

A valid triangle has all sides greater than 0 and for any given a, b and c sides, the following is true:

The difference between triangle types is

Equilateral:

Isosleces: ( or ) ( or )

Scalene:

Data type[edit]

Instructions say your program must read "three 32 bit signed integer" (int). Don't forget that you will have to sum the values, so if you use int, you will be able to receive the values but it will overflow when you sum them. You must use long int for your input variables.

Input[edit]

10
3 4 -5
5 3 5
6 2 9
1 2 7
2147483647 2147483647 2147483647
6 0 6
2 6 1
8 7 9
5 5 5
3 7 5

Output[edit]

Case 1: Invalid
Case 2: Isosceles
Case 3: Invalid
Case 4: Invalid
Case 5: Equilateral
Case 6: Invalid
Case 7: Invalid
Case 8: Scalene
Case 9: Equilateral
Case 10: Scalene

Solution[edit]