Files
python/TangDou/山道长度.md
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

28 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### 行程问题
  甲、乙二人分别从山顶和山脚同时出发,沿同一山道行进。两人的上山速度都是$20$米/分,下山的速度都是$30$米/分。甲到达山脚立即返回,乙到达山顶休息$30$分钟后返回,两人在距山顶$480$米处再次相遇。山道长多少米?
##### 【答案】
分析:
- 如果乙不休息,则甲下山再上山的时间与乙上山再下山的时间相等,因此,甲回到山顶$30$分后乙到达山脚。
- 当再次相遇时,甲还有$480÷20=24$(分)到达山顶。
- 于是乙还需要走$30×(24+30)=1620$(米)
$\therefore$ 山道长:$1620+480=2100$(米)。
#### 扩展
甲、乙二人分别从山顶和山脚同时出发,沿同一山道行进。两人的上山速度都是$x$米/分,下山的速度都是$y$米/分。甲到达山脚立即返回,乙到达山顶休息$t$分钟后返回,两人在距山顶$z$米处再次相遇。山道长多少米?
```cpp {.line-numbers}
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, y, z, t;
cin >> x >> y >> t >> z;
int k = z / x; // 甲继续走到山顶的时间
// k+t:乙走到山底的时间
// y*(k+t):乙走的路程
// z+y*(k+t)=山道长度
cout << z + y * (k + t) << endl;
return 0;
}
```