HDU 5761 Rower Bo
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Special Judge
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 $v_1$,and the speed of the water flow is $v_2$.He will adjust the direction of $v_1$ 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,v_1,v_2$.
$0\le a\le 100, 0\le v1,v2,\le 100, a,v_1,v_2$ 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
这题在现场做的时候试图直接解微分方程,但微分方程推出来却发现没法解,但题解上说,直接解微分方程可以搞,可能是我推微分方程的姿势不对,有待研究,微积分快忘干净了,好惨。
我现场的思路是:
考虑直角坐标下的运动学方程:
\begin{align} \frac{dx}{dt} &= v_2-\frac{x}{\sqrt{x^2+y^2}}v_1 \\ \frac{dy}{dt} &= -\frac{y}{\sqrt{x^2+y^2}}v_1 \end{align}
注意到如果将运动学方程写成直角坐标$(r,\theta)$的形式会更方便:
由$x=r\cos{\theta}, y=r\sin{\theta}, r=\sqrt{x^2+y^2}$, 上面两式可化成:
\begin{align} \cos{\theta} \, \dot{r} -\dot{\theta}\sin{\theta} \, r &= v_2-v_1\cos{\theta} \\ \sin{\theta} \, \dot{r} + \cos{\theta} \, \dot{\theta} r &= -v_1\sin{\theta} \end{align}
由上述两方程可解出$\dot{r}, r$:
\begin{align} \dot{r} &= v_2\cos{\theta}-v_1 \\ r &= -\frac{v_2\sin{\theta}}{\dot{\theta}} \end{align}
将上两式代入
\begin{align} \dot{r}=\frac{dr}{dt} \end{align}
得
\begin{align} \frac{v_2\sin{\theta} \, \ddot{\theta}}{\dot{\theta}^2}-v_2\cos{\theta} = v_2\cos{\theta}-v_1 \end{align}
要从这个微分方程解出$\theta=\theta(t)$比较困难,我目前还解不出。
这个微分方程是可解的:
令
\[ \frac{d\theta}{dt} = f \]
则
\[ \frac{d^2\theta}{dt^2} = \frac{df}{dt} =\frac{df}{d\theta}\frac{d\theta}{dt} = \frac{df}{d\theta}f \]
将上两式代入原方程,得
\[ \frac{df}{f} = \frac{2v_2\cos{\theta} - v_1}{v_2 \sin{\theta}} d\theta = (2\cot{\theta} -\frac{v_1}{v_2}\csc{\theta}) d\theta \]
积分得
\[ \ln{f} = 2\ln{| \sin{\theta} |} - \frac{v_1}{v_2}\ln{| \csc{\theta} -\cot{\theta} |} +C_1 \]
即
\[ f(\theta) = C_2\frac{\sin^2{\theta}} {|\csc{\theta}-\cot{\theta}|^{ \frac {v_1} {v2} } } \]
但到这一步貌似也没什么用,就算把右边的关于$\theta$的积分积出来,还要再求反函数才能得到$\theta (t)$。再次好惨。。
可能如果选择解$r=r(t)$会简单一点,再试试吧。。逃。。。
题解上给出的做法是:
将
\[ \frac{dr}{dt} = v_2\cos{\theta}-v_1 \]
\[ \frac{dx}{dt} = v_2-\frac{x}{\sqrt{x^2+y^2}}v_1 = v_2 - v_1 \cos{\theta}\]
实际上第一式($\frac{dr}{dt}$的表达式)可直接写出来,不需要像上面那样去推导。由于题目已说明船相对于水流的速度时刻指向原点,那么自然有$ \frac{dr}{dt} = v_2\cos{\theta}-v_1 $
两式对$t$积分,从时刻$0$积到(到达原点的)时刻$T$,这两个定积分就写成:
\[ 0-a = - v_1T + v_2\int_{0}^{T}{\cos{\theta} \, \text{d}\theta} \]
\[0-0 = v_2T - v_1 \int_{0}^{T}{\cos{\theta} \, \text{d}\theta} \]
这样便可解出
\[ T = \frac{v_1a}{v_1^2 - v_2^2} \]
从而不能到达原点的情况是 $a>0$且$v_1\le v_2$。
HDU 5761 Rower Bo的更多相关文章
- hdu 5761 Rower Bo 物理题
Rower Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5761 Description There is a river on the Ca ...
- hdu 5761 Rower Bo 微分方程
Rower Bo Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total ...
- 【数学】HDU 5761 Rower Bo
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5761 题目大意: 船在(0,a),船速v1,水速v2沿x轴正向,船头始终指向(0,0),问到达(0, ...
- hdu 5761 Rowe Bo 微分方程
1010 Rower Bo 首先这个题微分方程强解显然是可以的,但是可以发现如果设参比较巧妙就能得到很方便的做法. 先分解v_1v1, 设船到原点的距离是rr,容易列出方程 \frac{ dr} ...
- hdu-5761 Rower Bo(数学)
题目链接: Rower Bo Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others ...
- HDU 5761 物理题
Rower Bo Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total ...
- HDU 5752 Sqrt Bo (数论)
Sqrt Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5752 Description Let's define the function f ...
- HDU 5753 Permutation Bo (推导 or 打表找规律)
Permutation Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequen ...
- HDU 5762 Teacher Bo (暴力)
Teacher Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5762 Description Teacher BoBo is a geogra ...
随机推荐
- ROS系统python代码测试之rostest
ROS系统中提供了测试框架,可以实现python/c++代码的单元测试,python和C++通过不同的方式实现, 之后的两篇文档分别详细介绍各自的实现步骤,以及测试结果和覆盖率的获取. ROS系统中p ...
- Cocos2d-x 3.4在AndroidStudio上编译配置
转载请标明出处:http://www.cnblogs.com/studweijun/p/4320778.html 1.准备好以下文件 1) AndroidStudio: https://dl.goo ...
- 一次由于开启 Safari 无痕浏览 引发的艰难“捉虫”事件
事件回顾 做了一个移动端的页面,测试的时候出现了一个诡异的 bug.别的浏览器都好好的,就 ios 的 Safari 浏览器页面停止了渲染,似乎是有一段 js 文件没有载入.但是奇怪的是,同一型号的 ...
- ASP.NET MVC3入门教程之第一个WEB应用程序
本文转载自:http://www.youarebug.com/forum.php?mod=viewthread&tid=91&extra=page%3D1 上一节,我们已经搭建好了AS ...
- VS2013 未找到与約束ContractName
vs2013打开项目无法加载项目,关闭时提示 未找到与約束ContractName... 解決方法,打開控制面板,找到下面這個程序 右击,选 择 修 复
- 帕雷托最优(Pareto optimality)、帕雷托效率(Pareto efficiency)
帕雷托最优(英语:Pareto optimality),或帕雷托最适,也称为帕雷托效率(英语:Pareto efficiency),是经济学中的重要概念,并且在博弈论.工程学和社会科学中有着广泛的应用 ...
- vi实战记录
vi编辑器在Unix和Linux中比较早期的,Vim是vi的扩展集,是对vi的加强. 服务器最小化,默认集成vi编辑器!了解vi常用命令,工作起来颇有-洪荒之力!!! 01.关于退出 :wq! -- ...
- 0929mysql前缀索引如何找到合适的位数
前缀索引,是指对于VARCHAR/TEXT/BLOB类型的字段建立索引时一般都会选择前N个字符作为索引.索引很长的字符列,会让索引变得大且慢.索引开始的部分字符,这样可以大大节约索引空间,从而提高索引 ...
- 揭秘PHP匿名函数
揭秘PHP匿名函数 定义:匿名函数就是没有名字的函数. 有2种形式的匿名函数: 形式1:将一个匿名函数"赋值"给一个变量--此时该变量就代表该匿名函数了! 形式2: 是直接将一个匿 ...
- git工作流程
git工作流程 一般工作流程如下: 克隆 Git 资源作为工作目录. 在克隆的资源上添加或修改文件. 如果其他人修改了,你可以更新资源. 在提交前查看修改. 提交修改. 在修改完成后,如果发现错误,可 ...