zoukankan      html  css  js  c++  java
  • 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$.

    $0le ale 100, 0le 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


    这题在现场做的时候试图直接解微分方程,但微分方程推出来却发现没法解,但题解上说,直接解微分方程可以搞,可能是我推微分方程的姿势不对,有待研究,微积分快忘干净了,好惨。

    我现场的思路是:

    考虑直角坐标下的运动学方程:

    egin{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, heta)$的形式会更方便:

    由$x=rcos{ heta}, y=rsin{ heta}, r=sqrt{x^2+y^2}$, 上面两式可化成:

    egin{align} cos{ heta} \, dot{r} -dot{ heta}sin{ heta} \, r &= v_2-v_1cos{ heta} \ sin{ heta} \, dot{r} + cos{ heta} \, dot{ heta} r &= -v_1sin{ heta} end{align}

    由上述两方程可解出$dot{r}, r$:

    egin{align} dot{r} &= v_2cos{ heta}-v_1 \  r &= -frac{v_2sin{ heta}}{dot{ heta}}   end{align}                

    将上两式代入

    egin{align}  dot{r}=frac{dr}{dt}   end{align}

    egin{align}  frac{v_2sin{ heta} \, ddot{ heta}}{dot{ heta}^2}-v_2cos{ heta} = v_2cos{ heta}-v_1  end{align}

    要从这个微分方程解出$ heta= heta(t)$比较困难,我目前还解不出。

    这个微分方程是可解的:

    [ frac{d heta}{dt} = f ]

    [ frac{d^2 heta}{dt^2} = frac{df}{dt} =frac{df}{d heta}frac{d heta}{dt} = frac{df}{d heta}f ]

    将上两式代入原方程,得

    [ frac{df}{f} = frac{2v_2cos{ heta} - v_1}{v_2 sin{ heta}} d heta = (2cot{ heta} -frac{v_1}{v_2}csc{ heta}) d heta ]

     积分得

    [ ln{f} = 2ln{| sin{ heta} |} - frac{v_1}{v_2}ln{| csc{ heta} -cot{ heta} |} +C_1 ]

    [ f( heta) = C_2frac{sin^2{ heta}} {|csc{ heta}-cot{ heta}|^{ frac {v_1} {v2} } } ]

    但到这一步貌似也没什么用,就算把右边的关于$ heta$的积分积出来,还要再求反函数才能得到$ heta (t)$。再次好惨。。

    可能如果选择解$r=r(t)$会简单一点,再试试吧。。逃。。。


    题解上给出的做法是:

    [ frac{dr}{dt} = v_2cos{ heta}-v_1 ]

    [ frac{dx}{dt} = v_2-frac{x}{sqrt{x^2+y^2}}v_1 = v_2 - v_1 cos{ heta}]

    实际上第一式($frac{dr}{dt}$的表达式)可直接写出来,不需要像上面那样去推导。由于题目已说明船相对于水流的速度时刻指向原点,那么自然有$ frac{dr}{dt} = v_2cos{ heta}-v_1 $

    两式对$t$积分,从时刻$0$积到(到达原点的)时刻$T$,这两个定积分就写成:

    [ 0-a = - v_1T + v_2int_{0}^{T}{cos{ heta} \, ext{d} heta}  ]

    [0-0 = v_2T - v_1 int_{0}^{T}{cos{ heta} \, ext{d} heta} ]

    这样便可解出

    [ T = frac{v_1a}{v_1^2 - v_2^2} ]

    从而不能到达原点的情况是 $a>0$且$v_1le v_2$。


     

  • 相关阅读:
    Leveldb Advanced
    loadrunner生成随机数
    用strtok函数分割字符串
    loadrunner关联及web_reg_save_param方法浅析
    Linux中find用法
    在LoadRunner中从数组类型的参数随机取值的方法
    LoadRunner可以把关联取值当作检查点来使用
    Oracle特殊字符转义:&和'
    LoadRunner 11 error:Cannot initialize driver dll
    用SecureCRT在windows和CentOS间上传下载文件
  • 原文地址:https://www.cnblogs.com/Patt/p/5708708.html
Copyright © 2011-2022 走看看