HDU 5761 物理题

Rower Bo

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 650    Accepted Submission(s): 203
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 .

0a100 , 0v1,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 104 , your solution will be accepted.
 
Sample Input
2 3 3
2 4 3
 
Sample Output
Infinity
1.1428571429
 
Source
 
 
题意 :一个人要坐船过河,从起点(0,a)到终点(0,0),河流和x轴平行,船的速度为v1,水流速度为v2(X轴正方向),要求船的速度的方向一直指向终点(0,0),求船行驶的时间
 
题解:
 
 
 1 /******************************
 2 code by drizzle
 3 blog: www.cnblogs.com/hsd-/
 4 ^ ^    ^ ^
 5  O      O
 6 ******************************/
 7 //#include<bits/stdc++.h>
 8 #include<iostream>
 9 #include<cstring>
10 #include<cmath>
11 #include<cstdio>
12 #define ll long long
13 #define mod 1000000007
14 #define PI acos(-1.0)
15 using namespace std;
16 int main()
17 {
18     double a,v1,v2;
19     while(scanf("%lf %lf %lf",&a,&v1,&v2)!=EOF)
20     {
21     if(a==0)
22     cout<<"0.00000"<<endl;
23     else if(v1<=v2)
24     {
25         cout<<"Infinity"<<endl;
26     }
27     else
28     {
29       printf("%.10f
",a*v1/(v1*v1-v2*v2));
30     }
31     }
32     return 0;
33 }
 
原文地址:https://www.cnblogs.com/hsd-/p/5709471.html