思路:比赛的时候看到样例答案就是8/7,然后猜了几发公式...

正解:

首先这个题微分方程强解显然是可以的,但是可以发现如果设参比较巧妙就能得到很方便的做法。

先分解v_1v​1​​,

设船到原点的距离是rr,容易列出方程

\frac{ dr}{ dt}=v_2\cos \theta-v_1​dt​​dr​​=v​2​​cosθ−v​1​​

\frac{ dx}{ dt}=v_2-v_1\cos \theta​dt​​dx​​=v​2​​−v​1​​cosθ

上下界都是清晰的,定积分一下:

0-a=v_2\int_0^T\cos\theta{ d}t-v_1T0−a=v​2​​∫​0​T​​cosθdt−v​1​​T

0-0=v_2T-v_1\int_0^T\cos\theta{ d}t0−0=v​2​​T−v​1​​∫​0​T​​cosθdt

直接把第一个式子代到第二个里面

v_2T=\frac{v_1}{v_2}(-a+v_1T)v​2​​T=​v​2​​​​v​1​​​​(−a+v​1​​T)

T=\frac{v_1a}{{v_1}^2-{v_2}^2}T=​v​1​​​2​​−v​2​​​2​​​​v​1​​a​​

这样就很Simple地解完了,到达不了的情况就是v_1< v_2v​1​​<v​2​​(或者a>0a>0且v_1=v_2v​1​​=v​2​​)。

#include<cmath>
#include<cstring>
int main()
{double a,v1,v2;while(scanf("%lf%lf%lf",&a,&v1,&v2)==3){if(a==0){printf("0.0000000000\n");continue;}if(v1<=v2){printf("Infinity\n");continue;}double ans=a*v1,p=v1*v1-v2*v2;ans/=p;printf("%.10lf\n",ans);}
Problem Description
There is a river on the Cartesian coordinate system,the river is flowing along the x-axis direction.

Rower Bo is placed at (0,a) at first.He wants to get to origin (0,0) by boat.Boat speed relative to water is v1,and the speed of the water flow is v2.He will adjust the direction of v1 to origin all the time.

Your task is to calculate how much time he will use to get to origin.Your answer should be rounded to four decimal places.

If he can't arrive origin anyway,print"Infinity"(without quotation marks).

Input
There are several test cases. (no more than 1000)

For each test case,there is only one line containing three integers a,v1,v2.

0≤a≤100, 0≤v1,v2,≤100, a,v1,v2 are integers

Output
For each test case,print a string or a real number.

If the absolute error between your answer and the standard answer is no more than 10−4, your solution will be accepted.

Sample Input
2 3 3 2 4 3
Sample Output
Infinity 1.1428571429
Source
2016 Multi-University Training Contest 3

hdu5761 Rower Bo(物理题or瞎猜)相关推荐

  1. hdu 5761 Rower Bo 物理题

    Rower Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5761 Description There is a river on the Ca ...

  2. HDU 5761 Rower Bo 物理题(积分求时间)

    点击打开链接 题意: 有一个船在(0,a),船头的方向一直指着(0,0)位置,速度是v1,然后有一个水流速度是v2,朝着x轴正半轴方向流. 问你什么时候船到达(0,0)位置 题解: 首先这个题微分方程 ...

  3. hdu-5761 Rower Bo(数学)

    题目链接: Rower Bo Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 131072/131072 K (Java/Others ...

  4. HDU5761 Rower Bo

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5761 [题意]船在(0,a),存在一个恒定向右的速度v2,一个始终指向源点的速度v1,问到达源点的时间 ...

  5. HDU 5761 多校联合 Rower BO

    题目链接:HDU5761 Rower Bo Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/ ...

  6. HDU 5761 Rower Bo(积分)

    题目链接:HDU 5761 题面: Rower Bo Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K ( ...

  7. 2016 多校赛3 A 水 B 期望,规律 C 各种博弈 J 物理题,积分 K 暴力,水

    2016 Multi-University Training Contest 3 A - Sqrt Bo 题意:给一个数 n,问n要多少次平方后化为1,如果超过5次输出"TAT". ...

  8. HDU 5761 Rower Bo

    传送门 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Special Ju ...

  9. 2016 Multi-University Training Contest 3 1010 Rower Bo

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5761 题目: Problem Description There is a river on the ...

最新文章

  1. Python使用numpy函数hsplit水平(按列)拆分numpy数组(返回拆分后的numpy数组列表)实战:水平(按列)拆分二维numpy数组、split函数水平(按列)拆分二维numpy数组
  2. Qt利用avilib实现录屏功能_利用 dogtail 快速进行 GUI 自动化测试
  3. Windows下编译TensorFlow1.3 C++ library及创建一个简单的TensorFlow C++程序
  4. linux下安装sz/rz命令
  5. 如何提升网站在移动端的打开速度(转)
  6. Oracle 项目就是那回事 ----表空间的管理
  7. 单片机第13课:串口通信---向计算机发送数据
  8. 如何用js语句给mysql添加内容_在js里写SQL的方法
  9. Java面试必问!Spring事务扩展机制(2)
  10. 用mysqlslap对MySQL进行压力测试
  11. OpenWrt分支LEDE嵌入式无线路由系统定制-1.编辑环境搭建
  12. 解决Zabbix网页端Get value error: cannot connect to [[192.168.238.139]:10050]: [113] No route to host问题...
  13. 设计模式——代理模式与装饰模式的异同
  14. Spring框架工作原理
  15. 计算机硬盘突然只有一个c盘,win10硬盘消失了只剩下c盘怎么恢复_win10硬盘突然消失只有c盘解决方法-win7之家...
  16. css 右键菜单 边框,CSS+JavaScript打造超酷右键菜单
  17. stm32项目实战ST7735环境质量检测仪
  18. 限制不互素对的排列(构造)
  19. 第一天Java学习笔记
  20. 使用 electron-builder 及 electron-updater 给项目配置自动更新

热门文章

  1. 微前端在得物客服域的实践/那么多微前端框架,为啥我们选Qiankun + MF
  2. MySQL基础教程---创建、查询、备份数据库
  3. html+css+js简单实现图片轮播效果
  4. 模型压缩工具Distiller-INT8量化
  5. cip核字号验证_cip核字号(cip数据核字号查询官网)
  6. 专访实战专家,揭秘iOS神奇开发之路
  7. 讨厌的HR [转贴] --一篇颇有争议的文章
  8. IIS或Apache部署Django项目时,Admin后台管理CSS样式丢失?
  9. beyond compare linux文件夹,Beyond Compare比较文件夹的方法
  10. linux获取系统信息(sysinfo函数的使用)