Цитата:
Сообщение от Radist61
2)Задача про машины. С клавиатуры задается расстояние между двумя пунктмами "А" и "В". Из пункта "А" в пункт "В" выезжает легковой автомобиль со скоростью V1(Задается с клавиатуры). Через какое то время(тоже задается с клавиатуры) из пункта "А" в пункт "В" выезжает грузовой автомобиль со скоростью V2(вводится с клавиатуры) задача должна посчитать,через какое время грузовой автомобиль догогит легковой,и догонет ли вообще???
|
Код:
VAR
S0,Sx,T0,Tx,V1,V2:REAL;
BEGIN
Write('Distance between A and B (km) = ');
ReadLn(S0);
Write('The car velocity (km/h) = ');
ReadLn(V1);
Write('The lorry velocity (km/h) = ');
ReadLn(V2);
Write('The delay time of lorry start (hours) = ');
ReadLn(T0);
WriteLn;
If Round(V1*10000)>=Round(V2*10000) then
begin
WriteLn('The automobiles will never meet, because the lorry');
WriteLn('is slower then the car or has the same velocity');
end else
begin
Tx:=V1*T0/(V2-V1);
Sx:=Tx*V2;
If Sx>S0 then
begin
WriteLn('The automobiles will not meet, because the car will reach');
WriteLn('the B point before the lorry would catch it');
end else
begin
WriteLn('The automobiles will meet in ',Tx:5:3,' hours');
WriteLn('at a distanse of ',Sx:6:2,' kilometers from A point');
end;
end;
ReadLn;
END.