题目:

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
 
采用数学方法,很simple~
但是WA了~错在.....很让人无语的地方......= =下次要细心点!!!!
代码:
 #include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std; const double g=9.8; int main()
{
int n;
scanf("%d",&n);
while(n--)
{
double t,s,x,y,v;
scanf("%lf%lf%lf",&x,&y,&v);
t=v*v*v*v*x*x-g*x*x*(g*x*x+*v*v*y);
if(t<)
printf("-1\n");
else
{ s=(*v*v*x-*sqrt(t))/(*g*x*x);
if(s<)
s=(*v*v*x+*sqrt(t))/(*g*x*x);
printf("%.6lf\n",atan(s));
}
}
return ;
}
 
 
 
 
 

最新文章

  1. [Cocos2d-x For WP8]Transition 场景切换
  2. angularJS自定义指令模板替换
  3. 关于使用&quot;/&quot;来 dispatcherServlet 的url-pattern带来的问题
  4. ax 的错误处理范例
  5. uva 10274 Fans and Gems(隐式图搜索+模拟)
  6. Vim的tag系统
  7. Good practice release jar to Nexus
  8. Linux 的使用基础---Shell程序设计
  9. iOS开发tips总结
  10. React-Native入门指南之HelloWorld
  11. Java自学手记——接口
  12. lodash源码分析之chunk的尺与刀
  13. Go中的iota
  14. VueJs 自定义过滤器使用总结
  15. dede织梦系统接入熊掌号推送api,完整详细教程
  16. VO和DO转换(二) BeanUtils
  17. MCMC等采样算法
  18. You Don&#39;t Know JS: this &amp; Object Prototypes( 第2章 this)
  19. CNN 参数计算
  20. nginx: [error] open() &quot;/usr/local/var/run/nginx.pid&quot; failed (2: No such file or directory)

热门文章

  1. [C#]递归遍历文件夹
  2. 解决DataGridView.DataSource重复赋值而不显示问题
  3. IE11的CSS兼容性问题
  4. 使用Yii框架中遇到的三个问题
  5. a标签拨打电话、发短信、发邮件
  6. Python 学习之urllib模块---用于发送网络请求,获取数据(5)
  7. iOS 之 多线程一
  8. BZOJ 1620: [Usaco2008 Nov]Time Management 时间管理
  9. 【2011 Greater New York Regional 】Problem G: Rancher&#39;s Gift
  10. 【BZOJ 2005】[Noi2010]能量采集 (容斥原理| 欧拉筛+ 分块)