CDC12_C - Collision Issue
When Ronny finished his routines, received a call from the Center of Extraordinary Investigations Defining Excluded Creatures (or CEIDEC by its acronym).
CEIDEC found a planet going through the orbit of the Earth at a great velocity, the planet was named Rainbowland by its fancy colors. We don’t know if this planet contains living creatures, what CEIDEC knows is that the collision is almost imminent. However, that’s why the CEIDEC calls you: to create a program that, given three points in the space and assuming that the space only has two dimensions, compute if the three given points makes a perfect triangle, an isosceles triangle or an scalene triangle.
In addition, CEIDEC would like to know the angle formed by these three points. Computing this would make the calculations for collision easier to perform. Obviously, CEIDEC will give you a useful formula to discover the angle ? on the triangle knowing the length of sides A, B and C. You must manipulate the following formula in order to get the angle formed by these three points:
sqrt( (A2) + (B2) - [ {8 * A3 * B3}^(1/3) * sin3(ø) * cot3(ø) * sec2(ø) ] ) = c
That formula will find the angle between the vertex a and b. You must find if a triangle is equilateral, isosceles or scalene and, in addition, you must find the name of the interior angular triangle, knowing that.
- The sum of all interior angles must be equal to 180°
- A triangle will be equiangular if all the angles are the same.
- A triangle will be right triangle if one and only one angle is equal to 90°
- A triangle will be obtuse if one angle is greater than 90°
- A triangle will be acute if all the angles are less than 90°
Two floating points numbers will be considered equal if their absolute difference is lower than 10-2 when rounded, for instance 3.14159265 is rounded to 3.14.
Input
The first line contains an integer T, which specifies the number of test cases. Then, will follow the descriptions of T test cases.
Each case will contain 3 lines, each of these three lines will contain two numbers, denoting the coordinates (x, y) of every vertex in the triangle. The input must be read from standard input.
Output
For each input case you must print the string "Scenario #i:" where i is the test case you are analyzing (starting at 1) followed by the name by side of the triangle and (only for large cases) the name by interior angle of the triangle separated by a single space. The output must be written to standard output.
Sample
Input 4 0 0 0 3 3 0 0 0 0 4 3.464 2 1 1 5 5 4 0 1252 1322 1904 1950 1700 1700 Output Scenario #1: Isosceles Right Triangle Scenario #2: Equilateral Equiangular Scenario #3: Scalene Acute Scenario #4: Scalene Obtuse
Constraints
- 1 ≤ T ≤ 100
- -1,000,000 ≤ X ≤ 1,000,000
- -1,000,000 ≤ Y ≤ 1,000,000
hide comments
Simes:
2018-05-30 07:43:33
"Each case will contain 3 lines, each of these three lines will contain two integers..." The sample input has "3.464 2". Last time I checked, 3.464 wasn't an integer. |
|
Bhavik:
2014-07-13 15:06:44
same exact code not getting accepted in C but AC in C++!! |
|
Pranay:
2012-11-29 01:27:58
Cant get why WA ? (id: 8139285) though i've considered floating point comparisons
|
Added by: | Venezuelan Programming League |
Date: | 2012-10-27 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Own problem used for UCV-CEIDEC contest. |