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(""))...语句,这些语句其实是编译器的一种优化方式,具 ...
随机推荐
- Vue(4)- 获取原生的DOM的方式、DIY脚手架、vue-cli的使用
一.获取原生的DOM的方式 在js中,我们可以通过id.class或者标签获取DOM元素,vue中也为我们提供了获取原生DOM的方法,就是给标签或者组件添加ref属性,通过this.$refs获取,如 ...
- MySQL数据库(4)- 多表查询、可视化工具Navicat的使用、设计模式MVC
一.多表查询 准备工作:创建两张表,部门表(department).员工表(employee),代码和表格如下: # 创建表 create table department( id int, name ...
- asp.net Mvc Npoi 导出导入 excel
因近期项目遇到所以记录一下: 首先导出Excel : 首先引用NPOI包 http://pan.baidu.com/s/1i3Fosux (Action一定要用FileResult) /// < ...
- loc、iloc、ix比较
使用pandas创建一个对象 In [1]: import pandas as pd In [2]: import numpy as np In [3]: df = pd.DataFrame(np.r ...
- Mootools遮罩层练习(原为网上的jquery写法)
<html > <head> <meta charset="utf-8" /> <title>mootools 遮罩层</ti ...
- 微信小程序组件form
表单组件form:官方文档 Demo Code: Page({ formSubmit: function(e) { console.log('form发生了submit事件,携带数据为:', e.de ...
- Java面向对象—继承
概述: 1.多个类相同的属性和功能抽取成另一个类, 让具有特有功能的类继承这个类. 2.通过 extends 关键字可以实现类与类的继承 格式: class 子类名 extends 父类名 {} 特点 ...
- mount、umount、fuser命令使用小结
mount -t cifs -o username=administrator,password=xxxxx //192.168.11.17/Data/ /mnt/databak/之后想卸载挂载目录, ...
- MySQL-5.7创建及查看数据库表
1.创建数据库表的三种语句 创建一个新表: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name (create_definition,...) [tab ...
- jQuery全屏图片焦点图
在线演示 本地下载