Contest.uni-smr.ac.ru :: Programming contests in Samara
Русская версия || English version
Login:
Password:
Forget password?
 example: Bill Gates
 

Preparations for the linear algebra

Автор задачи: Неизвестен

Первоисточник: Курс аналитической геометрии

URL первоисточника: Тогда еще и инета-то не было...

Задачу добавил: bright

Успешно сдано решений: 3

...
The examination on the line - priceless.
There are things that can not be bought.
For everything else there is MasterCard.

Most recently, in secret underground laboratories SSAU (1 in 5 floor building, if someone does not know) has completed a project to create a mathematical robot. Alexander (so the robot is called) has a remarkable ability to determine the mathematical properties of any object entering the scope of its scanner. For example, if scaner zasechet any line, robot instantly give the equation of the line.

Failure student at the 1 st course SSAU Igor Kuznetsov, to pass the exam on linear algebra, kidnapped Alexander, thought he would be able to easily identify any type of curve, which draw him to the teacher. But all was not well and it's easy, because, as you know, the exam required to know the name of the curve and its canonical equation. Therefore, Igor asked you to help him.

Of course linear algebra, we all know that there are 8 types of curves of the second order. They are:
1. Ellipse (canonical equation x2/a2 + y2/b2 = 1)
2. Hyperbole (x2/a2 - y2/b2 = 1)
3. Parabola (y2 = 2px)
4. A pair of parallel direct (y2 - a2 = 0)
5. A pair of intersecting direct (y2 - k2x2 = 0)
6. Direct (y2 = 0)
7. Point (x2 + y2 = 0)
8. Empty lot (x2 + y2 + 1 = 0 and x2 + 1 = 0)

Alexander, the processing directly, gives a general equation of the form Ax2 + Bxy + Cy2 + Dx + Ey + F = 0. Now you have to bring this equation to the canonical form and give an answer.

So, at the entrance you expect:
The first line - an integer N (1 <= N <= 108)
and further, every new line of coefficients A, B, C, D, E, F (-32768 <= A, B, C, D, E, F <= 32767) in the overall equation, the curve of the second order.

At the exit you want in the i-th row to write a kind of curve, given i-s equation. Output 1, if ellipse, 2, if the hyperbole, etc. (numbering above).

Sample input file # 1:
1
1 0 1 0 0 -1
Example output file # 1:
1

Sample input file # 2:
4
1 0 -1 0 0 -1
1 -2 1 0 0 1
1 0 0 0 0 0
-1 0 0 0 1 0
Example output file # 2:
2
8
6
3


Translated by translate.google.ru :))))))

Submit

Задать вопрос жюри по этой задаче