Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project1;
- {$APPTYPE CONSOLE}
- {$R *.res}
- uses
- System.SysUtils;
- type
- TArray = array of Integer;
- var
- height, v1, v2, stops: integer;
- dist: double;
- flag: boolean;
- begin
- Write('Введите высоту столба: ');
- Readln(Height);
- Write('Введите скорость улитки: ');
- Readln(V1);
- Write('Введите скорость падения улитки: ');
- Readln(V2);
- if (V2 >= 4 * V1) and (V1 < Height) then
- stops := -1
- else
- begin
- dist := 0;
- stops := 0;
- flag := true;
- while flag do
- begin
- dist := dist + v1;
- if dist < Height then
- begin
- dist := dist - 0.25 * v2;
- Inc(stops);
- end
- else
- flag := False;
- end;
- end;
- writeln('Ответ:', stops);
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement