三分角度....

NPY and shot

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 236    Accepted Submission(s): 87

Problem Description
NPY is going to have a PE test.One of the test subjects is throwing the shot.The height of NPY is H meters.He can throw the shot at the speed of v0 m/s and at the height of exactly H meters.He wonders if he throws the shot at the best angle,how far can he throw ?(The acceleration of gravity, g, is $9.8m/s^2$)
Input
The first line contains a integer $T(T \leq 10000)$,which indicates the number of test cases.
The next T lines,each contains 2 integers $H(0 \leq h \leq 10000m)$,which means the height of NPY,and $v_0(0 \leq v_0 \leq 10000m/s)$, which means the initial velocity.
Output
For each query,print a real number X that was rounded to 2 digits after decimal point in a separate line.X indicates the farthest distance he can throw.
Sample Input
2 0 1 1 2
Sample Output
0.10 0.99

Hint

If the height of NPY is 0,and he throws the shot at the 45° angle, he can throw farthest.

Source
BestCoder Round #22
/* ***********************************************
Author        :CKboss
Created Time  :2014年12月13日 星期六 23时27分32秒
File Name     :C.cpp
************************************************ */#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>using namespace std;const double eps=1e-6;
const double g=9.8;double H,V;double Distan(double degree)
{double vx=V*sin(degree);double vy=V*cos(degree);double time = ( vx+sqrt(vx*vx+2*g*H) ) / g;return time*vy;
}int main()
{//freopen("in.txt","r",stdin);//freopen("out.txt","w",stdout);int T_T;scanf("%d",&T_T);while(T_T--){scanf("%lf%lf",&H,&V);double low=0.,high=90.;double mid1,mid2,ans=0;while(fabs(high-low)>=eps){mid1=(low*2+high)/3.;mid2=(low+high*2)/3.;double len1=Distan(mid1);double len2=Distan(mid2);ans=max(ans,max(len1,len2));if(len2+eps>len1)low=mid1;else high=mid2;}printf("%.2lf\n",ans);}return 0;
}

HDOJ 5144 NPY and shot 简单物理相关推荐

  1. hdu 5144 NPY and shot(三分)

    http://acm.hdu.edu.cn/showproblem.php?pid=5144 题意 :给出初速度 v 和高度 h 求最远斜抛距离 思路:根据物理公式推出 距离  s=v*cos(x)* ...

  2. BestCoder22 1003.NPY and shot 解题报告

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5144 题目意思:有个人抛物体,已知抛的速度和高度,问可以抛到的最远距离是多少.即水平距离. 做的时候是 ...

  3. HDOJ(HDU) 1994 利息计算(简单题目)

    Problem Description 为自行解决学费,chx勤工俭学收入10000元以1年定期存入银行,年利率为3.7% .利率 按年计算,表示100元存1年的利息为3.7元.实际上有时提前有时推迟 ...

  4. hdoj - 1258 Sum It Up hdoj - 1016 Prime Ring Problem (简单dfs)

    http://acm.hdu.edu.cn/showproblem.php?pid=1258 关键点就是一次递归里面一样的数字只能选一次. 1 #include <cstdio> 2 #i ...

  5. matlab三个简单物理建模实例(笔记)

    [实例 1.1]试对空气中在重力作用下不同质量物体的下落过程进行建模和仿真.已知重力加速度 g = 9.8m/s 2 ,在初始时刻 t 0 = 0s 时物体由静止开始坠落.空气对落体的影响可以忽略不计 ...

  6. HDOJ 5142 NPY and FFT

    题意:给一个数,转化为二进制后,反转后,去除前导零,在转化为十进制输出. 链接:http://acm.hdu.edu.cn/showproblem.php?pid=5142 思路:模拟,将数转化二进制 ...

  7. OpenGL实现碰撞检测与模拟重力效果(简单的物理系统)

    最近在做一个OpenGL的小游戏,想要实现碰撞检测与模拟重力效果,即类似Unity3d的物理引擎.碰撞检测参考了一篇博文: http://blog.csdn.net/zju_fish1996/arti ...

  8. HDOJ 1012-1020

    最近感冒了,有点小咳嗽,做题速度比较慢,本以为这周会做的比较少,没想到全是水题...我做的也蛮开心的@.@...对自己无语 HDOJ 1012 这个题目蛮简单,就是输出格式比较烦,处理好格式基本就没问 ...

  9. Tensorflow入门——自制数据集:将未经处理的图片制成npy格式的数据集

    一些吐槽和文章简介 博主是那种"拿来就用,不会再查"的人.而几乎所有教程都秉持着"这应该是python课教的"的理念,从而使得没学过python的人颇为头疼.博 ...

最新文章

  1. 直播|俄勒冈州立大学李伏欣:从热点图到对深度网络的结构化解释
  2. Retrofit 入门和提高
  3. Flv网络播放器制作全攻略
  4. 算法 | 尺度不变特征变换匹配算法 Scale Invariant Feature Transform (SIFT)
  5. kali linux fuzz工具集简述
  6. linux文件权限umask,linux系统中UMASK权限的用法讲解
  7. Python中defaultdict用法
  8. [Java] 蓝桥杯 BASIC-2 基础练习 01字串
  9. Nginx启动报[10013]错误
  10. Exchange Server 2010全新部署
  11. Java Scanner类nextLine和nextInt不能同用问题
  12. 崚 不能被 iconv(gb2312,utf-8 ,string)
  13. 重磅!吴恩达新书《机器学习训练秘籍》中文版来了(附PDF下载)
  14. 新浪和腾讯微博开放平台比较
  15. 华为手机root过程
  16. 超详细3D建模教学他来了
  17. 微软2017年预科生计划在线编程笔试第二场-#1498 : Diligent Robots
  18. 捷豹:车到用时方知养,可知彼时恨太迟
  19. Longest Substring with Same Letters after Replacement (hard)
  20. volice java_Volice~亡者之声~

热门文章

  1. 大数据归档-冷热数据分离
  2. chrome操作系统_如何在Chrome和Chrome操作系统上使用Google Play电影
  3. 记录下载com.mysql.jdbc.Driver驱动包过程
  4. springboot毕设项目牙无忧6ayy4(java+VUE+Mybatis+Maven+Mysql)
  5. 社科院与杜兰大学金融管理硕士——承载梦想,带自己遨游世界的“风帆”
  6. 黑群晖DSM安装教程及详细配置
  7. 亿图图示--工业自动化模块--啤酒生产处理流程简图和热水冷凝处理架构
  8. 《交互式程序设计 第2版》一1.2 交互领域中的编程
  9. 【docker 安装-环境初始化】
  10. rss阅读器保存html文件,4款在线RSS阅读器使用体验