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. vs中发布WebSever时启用HTTP-POST和HTTP-GET这两种协议

    一.问题介绍 在vs中建立一个websever项目时候默认是禁用HTTP-POST和HTTP-GET这两种协议的.但是如果你是在本机上去调试或者是在iis中浏览都会有HTTP-POST这种方式,因为这 ...

  2. druapl7:"Notice: A non well formed numeric value encountered 在 _hierarchical_select_hierarchy_generate() "

    这个是很诡异的一个Notice错误提醒,因为我在Drupal7.54+PHP7.0.1的环境下,并没有报这个错.但是我再Drupal7.59+PHP7.1.7的环境下就报错了.很奇怪,按照报错信息bi ...

  3. css网页布局血泪经验

    刚开始学css,没想到写页面刚写个banner就出了不少问题,写了几个下午都没有搞定对齐问题,现在从分析源码开始,尽量理解,总结,记住一般页面是从哪里开始布局的... 有些页面文字居中,其实不是用di ...

  4. atitit.js 与c# java交互html5化的原理与总结.doc

    atitit.js 与c# java交互html5化的原理与总结.doc 1. 实现html5化界面的要解决的策略1 1.1. Js交互1 1.2. 动态参数个数1 1.3. 事件监听2 2. sen ...

  5. Android网络请求库RetrofitUtils

    RetrofitUtils GitHub地址,帮忙给个Star 项目介绍 Retrofit+Okhttp辅助类的简单封装,vesion 1.0.X 实现了Get,Post-Form.Post-Json ...

  6. eclipse安装lua

    单击Eclipse->Help->Install New Software… 在Work with中输入网址 Kepler - http://download.eclipse.org/re ...

  7. Oracle EBS 创建资产报错

    Solution:设置资产弹性域 随便输入一个值 再冻结

  8. mac 打开整个系统的隐藏文件

    打开:defaults write com.apple.finder AppleShowAllFiles -bool true 关闭:defaults write com.apple.finder A ...

  9. ubuntu-15.04-desktop-amd64想要安装KDE桌面,结果出现如下问题

    The following packages have unmet dependencies: kubuntu-desktop : Depends: ark but it is not going t ...

  10. [翻译] PNChart

    PNChart https://github.com/kevinzhow/PNChart You can also find swift version at here https://github. ...