
106  ZOJ Monthly, May 2011  D
Quadratic surface is a secondorder algebraic surface given by the general equation Quadratic surfaces are also called quadrics, and there are 17 standardform types. A quadratic surface intersects every plane in a (proper or degenerate) conic section. In addition, the cone consisting of all tangents from a fixed point to a quadratic surface cuts every plane in a conic section, and the points of contact of this cone with the surface form a conic section. Examples of quadratic surfaces include the cone, cylinder, ellipsoid, elliptic cone, elliptic cylinder, elliptic hyperboloid, elliptic paraboloid, hyperbolic cylinder, hyperbolic paraboloid, paraboloid, sphere, and spheroid. Define
Also define Then the following table enumerates the 15 quadrics and their properties.
InputThere are multiple test cases. The first line of input is an integer T ≈ 10000 indicating the number of test cases. Each test case consists of a line containing 10 real numbers a, b, c, f, g, h, p, q, r, d. The absolute value of all numbers never exceed 1000. It's guaranteed that a^{2}+b^{2}+c^{2}>0. OutputFor each test case, output the type of quadratic surface ax^{2}+by^{2}+cz^{2}+2fyz+2gzx+2hxy+2px+2qy+2rz+d=0. See sample for more details. Sample Input3 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 Sample Outputellipsoid (imaginary) hyperboloid of two sheets hyperboloid of one sheet References
Author: WU, Zejun 