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. spark内核篇-task数与并行度

    每一个 spark job 根据 shuffle 划分 stage,每个 stage 形成一个或者多个 taskSet,了解了每个 stage 需要运行多少个 task,有助于我们优化 spark 运 ...

  2. C#面向对象19 值传递和引用传递

    值类型:int double char decimal bool enum struct引用类型:string 数组 自定义类 集合 object 接口 **值传递和引用传递1.值类型在复制的时候,传 ...

  3. 【原创】大数据基础之Gobblin(2)持久化kafka到hdfs

    gobblin 0.10 想要持久化kafka到hdfs有很多种方式,比如flume.logstash.gobblin,其中flume和logstash是流式的,gobblin是批处理式的,gobbl ...

  4. pycharm问题

    Pycharm 出现Unresolved reference '' 错误的解决方法:http://www.mamicode.com/info-detail-2190842.html

  5. 使用spring的test时,当配置文件不在classpath下,而在WEB-INF下

    @ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/applicationContext.xml"})

  6. Nginx 无法重启

    报错如下 Starting nginx... nginx (pid)already running. 重启nginx时,说多个进程已存在,,, 执行 ps -ef | grep nginx 发现 有多 ...

  7. Win10系统的开机启动项如何去关闭?

    我们在使用电脑时会安装许多的应用程序,而有些应用程序会默认在电脑开机时自行启动,不仅影响开机速度,还会在开机后占用电脑内存资源. 那么在Win10系统中,我们该如何查看有哪些开机启动项呢?我们又该怎么 ...

  8. python将list元素转为数字

    mask_x = ['11', '12', 13'] 方法1:for循环遍历 mask_x = [int(x) for x in mask_x] 方法2:map迭代 mask_x = list(map ...

  9. Delphi 图像组件(Image)

    樊伟胜

  10. 针对西门子PLC蠕虫的实现 

    研究背景 随着“互联网+”.“中国智能制造2025“.“工业4.0”等概念的提出,为了提高生产率,独立.隔离的传统工控领域将迎来了新的互联网时代,越来越多的工控设备(如控制器.机器人.数控机床)将被暴 ...