HDU 2298 Toxophily
题目:
Description
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
Technical Specification
1. T ≤ 100.
2. 0 ≤ x, y, v ≤ 10000.
Output
Output "-1", if there's no possible answer.
Please use radian as unit.
Sample Input
Sample Output
#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 ;
}
HDU 2298 Toxophily的更多相关文章
- HDU 2298 Toxophily(公式/三分+二分)
Toxophily Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- HDU 2298 Toxophily 【二分+三分】
一个人站在(0,0)处射箭,箭的速度为v,问是否能够射到(x,y)处,并求最小角度. 首先需要判断在满足X=x的情况下最大高度hmax是否能够达到y,根据物理公式可得 h=vy*t-0.5*g*t*t ...
- HDU -2298 Toxophily(三分法)
这道题目,可以推出物理公式直接来做,但是如果推不出来就必须用程序的一种算法来实现了,物理公式只是适合这一个或者某个题,但是这种下面这种解决问题的方法确实解决了一类问题 ----三分法,大家可能都听说过 ...
- HDU 2298 三分
斜抛从(0,0)到(x,y),问其角度. 首先观察下就知道抛物线上横坐标为x的点与给定的点的距离与角度关系并不是线性的,当角度大于一定值时可能会时距离单调递减,所以先三分求个角度范围,保证其点一定在抛 ...
- HDU 2298:Toxophily(推公式)
http://acm.hdu.edu.cn/showproblem.php?pid=2298 题意:给出一个x,y,v,问从(0,0)以v为初速度射箭,能否射到(x,y)这个点,如果能,输出最小的射出 ...
- Toxophily HDU - 2298 三分+二分
代码+解析: 1 //题意: 2 //有一个大炮在(0,0)位置,为你可不可以把炮弹射到(x,y)这个位置 3 //题目给你炮弹初始速度,让你求能不能找出来一个炮弹射出时角度满足题意 4 //题解: ...
- [hdu 2298] 物理推导+二分答案
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2298 #include<bits/stdc++.h> using namespace st ...
- HDU 2298(纯物理加解一元二次方程)
Toxophily Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
- Toxophily-数论以及二分三分
G - Toxophily Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submi ...
随机推荐
- 手机摇一摇效果-html5
1.手机摇一摇效果实现 2.播放声音 <!DOCTYPE html> <html lang="en"> <head> <meta char ...
- 『奇葩问题集锦』Ruby 切换淘宝源报错WARNING: Error fetching data: SSL_connect returned=1 errno=0 state=SSLv3 read s erver certificate B: certificate verify failed
===>首先需要使用https<===https://ruby.taobao.org/ 第一步 下载http://pan.baidu.com/s/1kU0rxtH 复制到ruby安装的根目 ...
- node-webkit:开发桌面+WEB混合型应用的神器
顾名思义, node -webkit就是 node js+webkit. 这样做的好处显而易见,核心奥义在于,用 node js来进行本地化调用,用webkit来解析和执行HTML+JS. 快速上手 ...
- Boost1.62+win7+VC2015编译
下载 通过boost官方网站, 或直接在source forge下载boost_1_62_0. 可选包 Zlib library, 环境变量: ZLIB_SOURCE bzip2, 环境变量: BZI ...
- iOS - 应用程序国际化
开发的移动应用更希望获取更多用户,走向世界,这就需要应用国际化,国际化其实就是多语言.这篇文章介绍Xcode4.5以后的国际化,包括应用名国际化和应用内容国际化.如果是Xcode4.5之前版本请参考. ...
- C++引用之引用的使用
一旦一个引用被声明,则该引用名就只能作为目标变量名的一个别名来使用,所以,不能再把该引用名作为其他变量名的别名,任何对该引用的赋值就是对该引用对应的目标变量名的赋值. 对引用求地址就是对目标变量求地址 ...
- bzoj 3823: 定情信物 线性筛逆元
3823: 定情信物 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 108 Solved: 2[Submit][Status] Descriptio ...
- http://jinnianshilongnian.iteye.com/blog/1996071
http://jinnianshilongnian.iteye.com/blog/1996071 http://my.oschina.net/jkcui/blog/388400 http://tian ...
- gdb调试高级用法
Linux下进程崩溃时定位源代码位置 如何在调试内核时,同时可以调试应用程序的做法: (cskygdb) c Continuing. ^C Program received signal SIGINT ...
- 转载:遍历Map的四种方法
http://www.cnblogs.com/kristain/articles/2033566.html 遍历Map的四种方法 public static void main(String[] ar ...