ZOJ 3488 Conic Section
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 section | equation |
|---|---|
| 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 a, b, c, d, e, f. The absolute value of any number never exceeds 10000. It's guaranteed that a2+c2>0, b=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
circle
ellipse
parabola
hyperbola
circle
References
- Weisstein, Eric W. "Conic Section." From MathWorld--A Wolfram Web Resource.
- http://mathworld.wolfram.com/ConicSection.html
#include <iostream>
#include<cstdio>
using namespace std;
double a,b,c,d,e,f;
int t;
int main()
{
scanf("%d",&t); //开始写成while(~scanf("%d",&t)),tle了
for(;t>;t--)
{
scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f); //题目没读清楚,题目说是实数,我用了%d,就wa了好几次
if (a==c) printf("circle\n"); else //判断是什么形状取决于a和c的关系。
if (a!=c && a*c>) printf("ellipse\n"); else
if (a== || c==) printf("parabola\n"); else
if (a*c<) printf("hyperbola\n");
}
return ;
}
ZOJ 3488 Conic Section的更多相关文章
- ZOJ 3430 Detect the Virus
传送门: Detect the Virus ...
- 【转载】图论 500题——主要为hdu/poj/zoj
转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并 ...
- ZOJ 4114 Detect the Virus(AC自动机)
Detect the Virus Time Limit: 2 Seconds Memory Limit: 65536 KB One day, Nobita found that his co ...
- POJ 1502 MPI Maelstrom / UVA 432 MPI Maelstrom / SCU 1068 MPI Maelstrom / UVALive 5398 MPI Maelstrom /ZOJ 1291 MPI Maelstrom (最短路径)
POJ 1502 MPI Maelstrom / UVA 432 MPI Maelstrom / SCU 1068 MPI Maelstrom / UVALive 5398 MPI Maelstrom ...
- ZOJ - 3430 Detect the Virus —— AC自动机、解码
题目链接:https://vjudge.net/problem/ZOJ-3430 Detect the Virus Time Limit: 2 Seconds Memory Limit: 6 ...
- Detect the Virus ZOJ - 3430 AC自动机
One day, Nobita found that his computer is extremely slow. After several hours' work, he finally fou ...
- keil MDK error: L6236E: No section matches selector - no section 错误
今天板子刚到,新建的第一个工程就报错了. .\Objects\cse.sct(7): error: L6236E: No section matches selector - no section t ...
- 【代码笔记】iOS-一个tableView,两个section
一,效果图. 二,工程图. 三,代码. RootViewController.h #import <UIKit/UIKit.h> @interface RootViewController ...
- gcc/linux内核中likely、unlikely和__attribute__(section(""))属性
查看linux内核源码,你会发现有很多if (likely(""))...及if (unlikely(""))...语句,这些语句其实是编译器的一种优化方式,具 ...
随机推荐
- Java集合类学习记录
被标记为transient的属性在对象被序列化的时候不会被保存int[] arr1 = {1, 2, 3, 4, 5}; int[] arr2 = Arrays.copyOf(arr1, new_le ...
- 请教Hibernate和JPA什么区别?
JPA是Java的持久化规范.Hibernate早期是一个ORM框架,后期是JPA的一个实现.
- delphi 改变闪动光标
delphi 改变闪动光标 // 不同风格的光标 procedure TForm1.Edit1MouseDown(Sender: TObject; Button: TMouseButton;Shift ...
- 微信小程序组件progress
基础内容progress:官方文档 Demo Code: Page({ data:{ percent:0 }, onReady:function(){ this.percentAdd(); }, pe ...
- linux crontab命令 自动下载文件
#crontab -e#download stock data, Mon-Fri, 9:15 - 11:30, 13:00 - 15:0015,30,40,50 9 * * 1-5 (cd /home ...
- Java 基础总结(二)
本文参见:http://www.cnblogs.com/dolphin0520/category/361055.html 1. 字节流与和字符流 1). 字符流操作时使用了缓冲区,而在关闭字符流时会强 ...
- cmd 命令 记忆
1,“开始”—>“运行”,输入cmd,回车.<或 win+R> 2,出现“命令提示符”的窗口,一般情况下是 C:\Documents and Settings\Administrat ...
- JSONP跨站访问
js中几种实用的跨域方法原理详解 这里说的js跨域是指通过js在不同的域之间进行数据传输或通信,比如用ajax向一个不同的域请求数据,或者通过js获取页面中不同域的框架中(iframe)的数据.只要协 ...
- Pytorch实现卷积神经网络CNN
Pytorch是torch的Python版本,对TensorFlow造成很大的冲击,TensorFlow无疑是最流行的,但是Pytorch号称在诸多性能上要优于TensorFlow,比如在RNN的训练 ...
- Spring Boot 中使用jsp
接SpringBoot 快速入门(Eclipse): 步骤一:视图支持 Springboot的默认视图支持是Thymeleaf,但是Thymeleaf我们不熟悉,我们熟悉的还是jsp. 所以下面是讲解 ...