Files
python/TangDou/XiTi/1420.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

50 lines
1.5 KiB
C++
Raw 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.

#include <bits/stdc++.h>
// 1253 距离
/*
旅游巴士从长春出发 3小时后休息 0.5 小时,然后用2/3的原速度继续前进,最后比原计划晚了1.5小时到达目的地沈阳.若出发 3小时又 60 公里后休息 0.5 小时,然后再以原速的2/3前进,到达沈阳时仅晚1 小时,那么长春距离沈阳多少公里?
*/
using namespace std;
/*
方法1:
原速度v,原时间t,距离s
3v+ 2v/3*(t+1.5-3-0.5)=s ①
v*t=s ②
3v+60+2v/3*(t+1-3-0.5-60/v)=s ③
3v+ 2v/3*(t+1.5-3-0.5)=v*t ②代入①
9v+2v(t+1.5-3-0.5)=3vt 等式左右乘3
9+2(t-2)=3t 左右除以v
9+2t-4=3t 去括号
t=5 得结果
v*t=s => s=v*5 将t=5代入②
3v+60+2v/3*(2.5-60/v)=5v 将s=v*5代入③
2v-60=2v/3*(2.5-60/v) 移项
v-30=v/3*(2.5-60/v) 两边除以2
3v-90=2.5v-60 两边乘以3
0.5v=30 化简
v=60 得结果
s=5v
s=5*60=300
*/
int main() {
return 0;
}
/*
方法2:
第二次与第一次相比,差别只有第一次以原速度多开了60公里,可以理解为汽车在60公里的距离里,如果按原速度开,和按
2/3的速度开,到达时间上会差0.5小时。
设速度为v,则有:
60/(2/3v)-60/v=0.5 => 90/v-60/v=0.5 => 30=0.5v => v = 60
3v+ 2v/3*(t+1.5-3-0.5)=v*t 将v=60代入
180+40*(t-2)=60t => 180-80=20t => t=5小时
s=t*v=60*5=300公里
*/