All submissions for this problem are available.
Read problems statements in Mandarin Chinese , Russian and Vietnamese as well.
Triangle classification is an important problem in modern mathematics. Mathematicians have developed many criteria according to which a triangle can be classified. In this problem, you will be asked to classify some triangles according to their sides and angles.
According to their measure, angles may be:
- Acute — an angle that is less than 90 degrees
- Right — a 90-degrees angle
- Obtuse — an angle that is greater than 90 degrees
According to their sides, triangles may be:
- Scalene — all sides are different
- Isosceles — exactly two sides are equal
According to their angles, triangles may be:
- Acute — all angles are acute
- Right — one angle is right
- Obtuse — one angle is obtuse
Triangles with three equal sides (equilateral triangles) will not appear in the test data.
The triangles formed by three collinear points are not considered in this problem. In order to classify a triangle, you should use only the adjactives from the statement. There is no triangle which could be described in two different ways according to the classification characteristics considered above.
The first line of input contains an integer SUBTASK_ID denoting the subtask id this input belongs to.
The second line of input contains an integer T denoting the number of test cases. The description of T test cases follows.
The only line of each test case contains six integers x1, y1, x2, y2, x3 and y3 denoting Cartesian coordinates of points, that form the triangle to be classified.
It is guaranteed that the points are non-collinear.
For each test case, output a single line containing the classification of the given triangle.
If SUBTASK_ID equals 1, then the classification should follow the "<Side classification starting with a capital letter> triangle" format.
If SUBTASK_ID equals 2, then the classification should follow the "<Side classification starting with a capital letter> <angle classification> triangle" format.
Please, check out the samples section to better understand the format of the output.
- 1 ≤ T ≤ 60
- |xi|, |yi| ≤ 100
- Subtask 1 (50 points): no additional constraints
- Subtask 2 (50 points): no additional constraints
The first test of the first subtask and the first test of the second subtask are the example tests (each in the corresponding subtask). It's made for you to make sure that your solution produces the same verdict both on your machine and our server.
Consider using the following condition in order to check whether two floats or doubles A and B are equal instead of traditional A == B: |A - B| < 10-6.
Input: 1 2 0 0 1 1 1 2 3 0 0 4 4 7 Output: Scalene triangle Isosceles triangle
Input: 2 6 0 0 4 1 1 3 0 0 1 0 1 2 0 0 1 1 1 2 0 0 2 1 1 2 3 0 0 4 4 7 0 0 2 1 4 0 Output: Scalene acute triangle Scalene right triangle Scalene obtuse triangle Isosceles acute triangle Isosceles right triangle Isosceles obtuse triangle
|Tags||ad-hoc, basic-math, cakewalk, geometry, kostya_by, ltime32|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions