Rower Bo

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 641    Accepted Submission(s): 199
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 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
 
Recommend
wange2014   |   We have carefully selected several similar problems for you:       
 题意:一艘船在y轴非负轴上,一个岛在原点,任何时刻船的速度方向都指向岛,船的速度为v1,河流的速度为v2,且是向x轴正方向流,问船到达岛的最短时间;
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
typedef unsigned long long Ull;
#define MM(a,b) memset(a,b,sizeof(a));
const double eps = 1e-10;
const int inf =0x7f7f7f7f;
const double pi=acos(-1);
const int mod=1e9+7;
const int maxn=100000+10;
ll f_2[1000+10]; #define FOR(i,n) for(int i=1;i<=n;i++)
#define SC scanf
#define PF printf int main()
{
int a,v1,v2;
while(~SC("%d%d%d",&a,&v1,&v2)){
if(a!=0&&v1<=v2) PF("Infinity\n");
else if(!a) PF("0\n");
else PF("%.9f\n",v1*a/((double)(v1*v1-v2*v2)));
}
return 0;
}

  

1010 Rower Bo

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

先分解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​​)。

题解链接:

hdu 5761 Rower Bo 微分方程的更多相关文章

  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

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

  3. hdu 5761 Rowe Bo 微分方程

    1010 Rower Bo 首先这个题微分方程强解显然是可以的,但是可以发现如果设参比较巧妙就能得到很方便的做法. 先分解v_1v​1​​, 设船到原点的距离是rr,容易列出方程 \frac{ dr} ...

  4. 【数学】HDU 5761 Rower Bo

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5761 题目大意: 船在(0,a),船速v1,水速v2沿x轴正向,船头始终指向(0,0),问到达(0, ...

  5. hdu-5761 Rower Bo(数学)

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

  6. HDU 5761 物理题

    Rower Bo Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total ...

  7. HDU 5752 Sqrt Bo (数论)

    Sqrt Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5752 Description Let's define the function f ...

  8. HDU 5753 Permutation Bo (推导 or 打表找规律)

    Permutation Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequen ...

  9. HDU 5762 Teacher Bo (暴力)

    Teacher Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5762 Description Teacher BoBo is a geogra ...

随机推荐

  1. Linux操作系统文档

    一 Linux操作系统概述 l为什么要学习Linux操作系统: 1.  大部分服务端都是使用Linux操作系统(Django,爬虫,科学运算等项目是部署到服务器中的) 2.  一些企业和学校(国外学校 ...

  2. django初步了解

    目录 学前了解 wsgiref模块( web服务网关接口) 根据不同的功能拆封成不同的py文件 动静态网页 HTTP协议 django初步了解1 1.小白必会三板斧 2.静态文件配置 3.reques ...

  3. 协议相关(HTTP,TCP,webservice,socket)

    什么是协议? 我们常常点开的链接(URL)就有HTTP.HTTPS协议 枯燥点的知识(协议模型) HTTP,webservice都是在<TCP/IP协议>的应用层. TCP,socket在 ...

  4. X86逆向8:向程序中插入新区段

    本节课我们不去破解程序,本节课学习给应用程序插入一些代码片段,这里我就插入一个弹窗喽,当然你也可以插入一段恶意代码,让使用的人中招, 这里有很多原理性的东西我就不多罗嗦了毕竟是新手入门教程,如果想去了 ...

  5. 并不对劲的CF480E:Parking Lot

    题目大意 有一个\(n\times m\)的网格,每个位置是黑色或者白色.\(k\)个操作,每个操作是将一个白格子染黑,操作后输出当前最大的白色正方形的边长.\(n,m,k\leq 2\times 1 ...

  6. JavaScript设计模式(装饰者模式)

    一.模拟传统面向对象语言的装饰者模式: 假设我们在编写一个飞机大战的游戏,随着经验值的增加,我们操作的飞机对象可以升级成更厉害的飞机,一开始这些飞机只能发射普通的子弹,升到第二级时可以发射导弹,升到第 ...

  7. TreeMap——实现comparable接口并重写CompareTo方法

    public class TreeMapTest { public static void main(String[] args) { Map<Student,Integer> stude ...

  8. ubuntu下安装python-selenuim自动化测试的谷歌浏览器驱动安装的位置

    谷歌插件下载地址 https://npm.taobao.org/mirrors/chromedriver selenium下载地址 https://pypi.org/simple/selenium/ ...

  9. php 生成mysql数据字典 (php5.5-5.6)

    <?php /** * 生成mysql数据字典 */ //配置数据库 $dbserver = "127.0.0.1"; $dbusername = "root&qu ...

  10. php 获取网址参数

    echo "rewrite: ".$_GET["rewrite"]; echo "<br>SERVER_PORT: ".$_SE ...