106 - ZOJ Monthly, May 2011 - D
Quadratic surface is a second-order algebraic surface given by the general equation
Quadratic surfaces are also called quadrics, and there are 17 standard-form 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.
Then the following table enumerates the 15 quadrics and their properties.
There 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 a2+b2+c2>0.
For each test case, output the type of quadratic surface ax2+by2+cz2+2fyz+2gzx+2hxy+2px+2qy+2rz+d=0. See sample for more details.
3 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
ellipsoid (imaginary) hyperboloid of two sheets hyperboloid of one sheet
Author: WU, Zejun