HDU 5761 Rower Bo

16年多校的题目 传送门

题意:小船初始时位于目的地正上方距离a处,已知船在静水中速度v1,水的流速v2,船在运动过程中始终保持船头指向目的地,问经过多长时间小船到达目的地,如果不能到达输出Infinity。

emmm大物解题法上讲过的题目啊。

列两个方程式,一个是径向上的速度方程式,一个是水平方向上的速度方程式,分别进行积分,然后替换下就能得出T的公式了。

 1 #include <cstdio>
 2 #include <cstring>
 3 #include <iostream>
 4 #include <algorithm>
 5 using namespace std;
 6 typedef long long LL;
 7 
 8 int a, v1, v2;
 9 
10 
11 int main(int argc, const char * argv[]) {
12     while (~scanf("%d%d%d", &a, &v1, &v2)) {
13         if (a == 0) {
14             puts("0"); continue;
15         }
16         if (v1 <= v2) {
17             puts("Infinity");
18         } else {
19             double ans = (double)a * v1 / (v1 * v1 - v2 * v2);
20             printf("%.6lf
", ans);
21         }
22     }
23     return 0;
24 }
原文地址:https://www.cnblogs.com/xFANx/p/7353093.html