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 ...
随机推荐
- Entity Framework6 with Oracle(可实现code first)
Oracle 与2个月前刚提供对EF6的支持.以前只支持到EF5.EF6有很多有用的功能 值得升级.这里介绍下如何支持Oracle 一.Oracle 对.net支持的一些基础知识了解介绍. 1.早 ...
- PHP中WEB典型应用技术
主要讲5个方面: PHP与web页面的交互:表单传值,文件的上传与下载 http协议 PHP的会话技术:cookie和session PHP的图像技术:GD库,图像的常见的制作和操作,验证码,二维码, ...
- 仿造slither.io第一步:先画条蛇
前言 最近 slither.io 貌似特别火,中午的时候,同事们都在玩,包括我自己也是玩的不亦乐乎. 好久好久没折腾过canvas相关的我也是觉得是时候再折腾一番啦,所以就试着仿造一下吧.楼主也没写过 ...
- js单选和复选框
http://blog.csdn.net/chelen_jak/article/details/44827393 http://www.gbtags.com/technology/jquerynews ...
- 理解CDN
一.CDN定义 CDN的全称是Content Delivery Network,即内容分发网络.其基本思路是尽可能避开互联网上有可能影响数据传输速度和稳定性的瓶颈和环节,使内容传输的更快.更稳定.通过 ...
- Install marvel and head plugin for ealsticsearch
安装ES插件 marvel marvel是ES的供开发者免费使用的管理工具,他内置了一款叫做Sense的控制台,Sense是运行在浏览器中的,基于Sense可以很方便的和ES进行通讯.官方文档中的很多 ...
- git常用命令学习
Git commands 1. start a working area clone Clone a repository into a new directory init Create an em ...
- ActiveMQ_Linux安装(一)
一.下载:apache-activemq-5.14.0-bin.tar.gz http://activemq.apache.org/activemq-5140-release.html 二.安 ...
- 【PKUSC 2015的一道数学题】
有9个人,每三个人中至少有两个互相认识,求证这里面至少有4个人互相认识 PKU官方题解: 引理:二染色K6中一定有同色K3. 证明:考虑某一个点,它一定连出至少三条同色边(不妨设为红边),这三条边连的 ...
- Entity Framework Code First (一)Conventions
Entity Framework 简言之就是一个ORM(Object-Relational Mapper)框架. Code First 使得你能够通过C#的类来描述一个模型,模型如何被发现/检测就是通 ...