hdu 5761 Rower Bo 微分方程
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
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).
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
If the absolute error between your answer and the standard answer is no more than 10−4, your solution will be accepted.
2 4 3
1.1428571429
#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_1v1,

设船到原点的距离是rr,容易列出方程
\frac{ dr}{ dt}=v_2\cos \theta-v_1dtdr=v2cosθ−v1
\frac{ dx}{ dt}=v_2-v_1\cos \thetadtdx=v2−v1cosθ
上下界都是清晰的,定积分一下:
0-a=v_2\int_0^T\cos\theta{ d}t-v_1T0−a=v2∫0Tcosθdt−v1T
0-0=v_2T-v_1\int_0^T\cos\theta{ d}t0−0=v2T−v1∫0Tcosθdt
直接把第一个式子代到第二个里面
v_2T=\frac{v_1}{v_2}(-a+v_1T)v2T=v2v1(−a+v1T)
T=\frac{v_1a}{{v_1}^2-{v_2}^2}T=v12−v22v1a
这样就很Simple地解完了,到达不了的情况就是v_1< v_2v1<v2(或者a>0a>0且v_1=v_2v1=v2)。
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
传送门 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Special Jud ...
- hdu 5761 Rowe Bo 微分方程
1010 Rower Bo 首先这个题微分方程强解显然是可以的,但是可以发现如果设参比较巧妙就能得到很方便的做法. 先分解v_1v1, 设船到原点的距离是rr,容易列出方程 \frac{ dr} ...
- 【数学】HDU 5761 Rower Bo
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5761 题目大意: 船在(0,a),船速v1,水速v2沿x轴正向,船头始终指向(0,0),问到达(0, ...
- 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 ...
随机推荐
- 异或运算符(^)、与运算符(&)、或运算符(|)、反运算符(~)、右移运算符(>>)、无符号右移运算符(>>>)
目录 异或(^).异或和 的性质及应用总结 异或的含义 异或的性质:满足交换律和结合律 异或的应用 按位 与运算符(&) 按位 或运算符(|) 取 反运算符(~) 右移运算符(>> ...
- 版本管理工具svn(转)
这种操作类的文章就不自己再写了,感觉浪费时间. 找了一个写的不错的文章转载. 文中流程有些变动,但是问题不大,可能是版本原因. SVN服务器的本地搭建和使用 http://www.2cto.com/o ...
- 牛客 109B 好位置 (字符串水题)
大意: 给定字符串$s1,s2$, 对于$s1$中所有与$s2$相等的子序列$t$, $t$在$s1$中的下标定义为好位置. 求$s1$是否所有位置都是好位置. 显然$s1$的前缀要与$s2$相等, ...
- docker_nginx_php_mysql
https://blog.csdn.net/miwumuge/article/details/83386679 问题 1.容器内访问宿主机地址, host.docker.internal
- python 的面试题总汇
函数作用域; LEGB : L>E>G>B L : local函数内部作用域 E : enclosing函数内部与内嵌函数之间 G : global全局作用域 B : build-i ...
- LeetCode 腾讯精选50题--数组中的第K个最大元素
好吧,不得不承认,书上看到的始终不是自己的,只有亲身时间过才会明白该怎么操作. 找数组中第K个最大元素,简而言之就是先排序,不论使用哪种算法,都需要先排序,确认位置,由于数组可以通过下标直接访问,所以 ...
- 从零开始搭建react应用
用create-react-app搭建react应用,了解npm run start的工作过程. 第一步:安装脚手架 create-react-app 1. 在node里 npm install cr ...
- vue打开到新页面,并传递参数
打开新页面,有两种方式, 一种是标签式: <router-link tag="a" target="_blank" :to="{path: '/ ...
- 给没有连接因特网的centos使用yum安装其他软件(转)
https://blog.csdn.net/bbg221/article/details/78360618 在centos上,使用yum安装软件很方便,比如安装gcc,java等, 但是在没有网络的情 ...
- day12 css样式
目录 1.标签分类 2.浮动布局 3.margin塌陷 4.定位postion 5.背景图 一. 标签分类 默认在标准文档流 行内标签 span,a,em,i,strong,b,inp ...