0
点赞
收藏
分享

微信扫一扫

HDU 5761 Rower Bo


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


 



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


1.1428571429


推推公式就可以搞定的题,然而太弱不会推,只好瞎猜,竟然猜中了。

#include<set>
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<bitset>
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#define rep(i,j,k) for (int i = j; i <= k; i++)
#define per(i,j,k) for (int i = j; i >= k; i--)
using namespace std;
typedef long long LL;
const int low(int x) { return x&-x; }
const double eps = 1e-7;
const int mod = 1e9 + 7;
const int N = 1e3;
const int INF = 0x7FFFFFFF;
int T, x, y, z;

int main()
{
//scanf("%d", &T);
while (scanf("%d%d%d", &x, &y, &z) != EOF)
{
if (x == 0) printf("0\n");
else if (y <= z) printf("Infinity\n");
else
{
/*double X = 0, Y = x, ans = 0, t = eps;
while (Y > eps)
{
double XX = y*X / sqrt(X*X + Y*Y) - z;
double YY = y*Y / sqrt(X*X + Y*Y);
X -= XX*t; Y -= YY*t; ans += t;
}
printf("%lf %lf\n", X, Y);
printf("%lf\n", ans + X / (y - z));
*/
printf("%lf\n", 1.0*x*y / (y*y - z*z));
}
}
return 0;
}



举报

相关推荐

0 条评论