2014ACM集训13级PK赛2-Conic Section

Description

The conic sections are the nondegenerate curves generated by the intersections of a plane with one or two nappes of a cone. For a plane perpendicular to the axis of the cone, a circle is produced. For a plane that is not perpendicular to the axis and that intersects only a single nappe, the curve produced is either an ellipse or a parabola. The curve produced by a plane intersecting both nappes is a hyperbola.

conic sectionequation
circle x2+y2=a2
ellipse x2/a2+y2/b2=1
parabola y2=4ax
hyperbola x2/a2-y2/b2=1

Input

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 6 real numbers abcdef. The absolute value of any number never exceeds 10000. It's guaranteed that a2+c2>0b=0, the conic section exists and it is non-degenerate.

Output

For each test case, output the type of conic section ax2+bxy+cy2+dx+ey+f=0. See sample for more details.

Sample Input

5
1 0 1 0 0 -1
1 0 2 0 0 -1
0 0 1 1 0 0
1 0 -1 0 0 1
2 0 2 4 4 0

Sample Output

circleellipseparabolahyperbolacircle

References

 

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int N;
    scanf ("%d",&N);

    while (N--)
    {
        double a,b,c,d,e,f;
        scanf ("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f);

        if (a == c && (d * d + e * e - 4 * a * f > 0))
        {
            //yuan
            puts ("circle");
        }else if (a * c < 0 && ((d * d/(4 * a * a)) + (e * e/(4 * c * c)) - f) != 0)
        {
            //shuangquxian
            puts ("hyperbola");
        }else if ((a == 0  && c != 0&& d != 0) || (a != 0 && c == 0 && e != 0))
        {
            //paowuxian
            puts ("parabola");
        }else
        {
            //tuoyuan
            puts ("ellipse");
        }
    }
    return 0;
}


 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值