Toxophily

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2555    Accepted Submission(s): 1416

Problem Description
The recreation center of WHU ACM Team has indoor billiards, Ping Pang, chess and bridge, toxophily, deluxe ballrooms KTV rooms, fishing, climbing, and so on.
We all like toxophily.

Bob is hooked on toxophily recently. Assume that Bob is at point (0,0) and he wants to shoot the fruits on a nearby tree. He can adjust the angle to fix the trajectory. Unfortunately, he always fails at that. Can you help him?

Now given the object's coordinates, please calculate the angle between the arrow and x-axis at Bob's point. Assume that g=9.8N/m.

 
Input
The input consists of several test cases. The first line of input consists of an integer T, indicating the number of test cases. Each test case is on a separated line, and it consists three floating point numbers: x, y, v. x and y indicate the coordinate of the fruit. v is the arrow's exit speed.
Technical Specification

1. T ≤ 100.
2. 0 ≤ x, y, v ≤ 10000.

 
Output
For each test case, output the smallest answer rounded to six fractional digits on a separated line.
Output "-1", if there's no possible answer.

Please use radian as unit.

 
Sample Input
3
0.222018 23.901887 121.909183
39.096669 110.210922 20.270030
138.355025 2028.716904 25.079551
 
Sample Output
1.561582
-1
-1
 解题报告:
二分三分什么的好麻烦啊。。。。。。。。。。。。。。。。
直接按照做物理题的思路:

代码如下:

#include<bits/stdc++.h>
using namespace std;
const double PI=3.1415926535898;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
double x,y,v;
scanf("%lf %lf %lf",&x,&y,&v);
if(x==)//考虑特殊情况
{
if(y==)
printf("0.000000\n");
else
printf("%lf\n",PI/);
continue;
}
double t=x*x-*(4.9)*(x*1.0/v*1.0)*(x*1.0/v*1.0)*(4.9*(x*1.0/v*1.0)*(x*1.0/v*1.0)+y);
if(t>)
{
double r;
if(x>sqrt(t))
{
r=(x-sqrt(t))/(9.8*(x/v)*(x/v));
}else
{
r=(x+sqrt(t))/(9.8*(x/v)*(x/v));
}
printf("%lf\n",atan(r));
}else
{
printf("-1\n");
}
}
}
 
 
 

HDU 2298(纯物理加解一元二次方程)的更多相关文章

  1. java练习题:解一元二次方程、判断闰年、判断标准身材、三个数取最大值

    1.解一元二次方程 注:求根公式为(-b+根号德尔塔)/2a,(-b-根号德尔塔)/2a Scanner sc=new Scanner(System.in); System.out.println(& ...

  2. C语言写解一元二次方程程序心得

    前言:在网上看到不少解一元二次方程的小程序,在使用时总得出一大堆小数,感觉很不爽,遂自己重新写了一遍. 首先,先回忆一下一元二次方程的求根公式: 分别读取二次项.一次项和常数项系数并且求出delta ...

  3. 【Java例题】2.8 解一元二次方程

    8.解一元二次方程. 输入一元二次方程的a,b,c三个系数,解一元二次方程 ax^2+bx+c=0,输出两个根 package study; import java.util.Scanner; pub ...

  4. c语言解一元二次方程

    C语言解一元二次方程,输入系数a,b,c; #include <stdio.h> #include <math.h> int main(int argc, char *argv ...

  5. HDU 2092 (将表达式变成一元二次方程形式)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2092 整数解 Time Limit: 1000/1000 MS (Java/Others)    Me ...

  6. 用c++解一元二次方程

    解方程 github项目地址 这两天得知初二的表妹学了一元二次方程,听说还不会解,我就想着试试用C语言编写解方程. 一元二次方程 用公式法 这种方法效果很好: #include"funct. ...

  7. if语句解一元二次方程~

    #include<stdio.h>#include<math.h> void main(){  double a,b,c,x1,x2;  printf("请输入a&q ...

  8. HDU 5734 Acperience ( 数学公式推导、一元二次方程 )

    题目链接 题意 : 给出 n 维向量 W.要你构造一个 n 维向量 B = ( b1.b2.b3 ..... ) ( bi ∈ { +1, -1 } ) .然后求出对于一个常数 α > 0 使得 ...

  9. 解一元二次方程的C++实现

    一元二次方程的根的情况分为实根与虚根两种,代码如下 #include<iostream> #include<cmath> using namespace std; float ...

随机推荐

  1. ios上-webkit-overflow-scrolling与position的bug

    如上图,.fb-box是一个大div,包含着页面上的所有元素,包括所看到的那个弹窗.dialog-img,并且设置了height:100%;-webkit-overflow-scrolling:tou ...

  2. Django随笔

    入门 小Demo设计介绍 本示例完成“图书-英雄”信息的维护,需要存储两种数据:图书.英雄 图书表结构设计: 表名:BookInfo 图书名称:btitle 图书发布时间:bpub_date 英雄表结 ...

  3. Spring Boot—14JdbcTemplate

    pom.xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...

  4. GIS在水利中的应用

    摘要  GIS具有数据存储.查询.统计.图形显示.分析.模拟.决策和预测等功能,在水利中得到越来越广泛的应用,可谓水利现代化的“火车头”. 关键词 GIS 水利 应用 地理信息系统GIS通常泛指用于获 ...

  5. Global Average Pooling Layers for Object Localization

    For image classification tasks, a common choice for convolutional neural network (CNN) architecture ...

  6. frame shiro 认证示例及原理简述

    shiro 认证流程 1.创建一个 javaSE 的maven项目(quickstart),并添加依赖 <dependency> <groupId>junit</grou ...

  7. springCloud微服务入门

    目录 前言 Eureka 注册中心server 新建 配置 服务提供者service 新建 配置 服务消费者controller 新建 配置 使用 Feign负载均衡 前言 springCloud是一 ...

  8. 初探diskstats

    内核很多重要子系统均通过proc文件的方式,将自身的一些统计信息输出,方便最终用户查看各子系统的运行状态,这些统计信息被称为metrics. 直接查看metrics并不能获取到有用的信息,一般都是由特 ...

  9. iostat 工具分析I/O性能

    iostat命令用途:主要用于监控系统设备的IO负载情况,iostat首次运行时显示自系统启动开始的各项统计信息,之后运行iostat将显示自上次运行该命令以后的统计信息.用户可以通过指定统计的次数和 ...

  10. leveldb源码分析--Key结构

    [注]本文参考了sparkliang的专栏的Leveldb源码分析--3并进行了一定的重组和排版 经过上一篇文章的分析我们队leveldb的插入流程有了一定的认识,而该文设计最多的又是Batch的概念 ...