program L4A2;
{$APPTYPE CONSOLE}
uses
SysUtils;
{Hotp – часы и Motp – минуты. Известно время в пути: Hp – часы и Mp – минуты.
Четыре целых числа – часы и минуты отправления поезда, а также часы и минуты продолжительности поездки.
Выходные данные
Время прибытия: «HH час. : MM мин.»
количество полных суток – целое число. }
var Hotp, Motp, Mp, Hp, Days, Hours, Min: integer;
{Считывание данных}
procedure input(var Hotp, Motp, Hp, Mp:integer);
begin
readln(Hotp);
readln(Motp);
readln(Hp);
readln(Mp);
end;
{Вычисление количества дней}
function getDays(Hp, Mp:integer):integer;
begin
result:= (Hp*60+Mp) div 1440;
end;
{Вычислеиие времени прибытия в часах}
function getTimeH(Hotp, Motp, Hp, Mp:integer):integer;
var tempH, tempM:integer;
begin
tempH:=Hotp+Hp;
tempM:=Motp+Mp;
if (tempM >= 60) then
begin
while tempM >= 60 do
begin
tempH:=tempH+1;
tempM:=tempM-60;
end;
end;
if (tempH >= 24) then
begin
while (tempH >= 24) do
begin
tempH:=tempH-24;
result:=tempH;
end;
end
else result:=tempH;
end;
{Вычисление времени прибытия в минутах}
function getTimeM(Motp, Mp:integer):integer;
var tempM:integer;
begin
tempM:=Motp+Mp;
if (tempM >= 60) then
begin
while tempM >= 60 do
begin
result:=tempM-60;
end;
end
else result:= tempM;
end;
{Выводит результа}
procedure output(Min, Hours, Days:integer);
begin
if (Min > 9) and (Hours > 9)
then
begin
writeln(Hours,' hours : ',Min,' minutes');
writeln(Days,' days');
end
else
if (Min > 9) and (Hours < 10)
then
begin
writeln('0',Hours,' hours : ',Min,' minutes');
writeln(Days,' days');
end
else
if ( Min < 10) and (Hours < 10)
then
begin
writeln('0',Hours,' hours : ','0',Min,' minutes');
writeln(Days,' days');
end
else
begin
writeln(Hours,' hours : ','0',Min,' minutes');
writeln(Days,' days');
end
end;
begin
input(Hotp, Motp, Hp, Mp);
Days:=getDays(Hp, Mp);
Hours:=getTimeH(Hotp, Motp, Hp, Mp);
Min:=getTimeM(Motp, Mp);
output(Min, Hours,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9dGVtcE0tNjA7CiAgICBlbmQ7CiAgZW5kCiAgZWxzZSByZXN1bHQ6PSB0ZW1wTTsKZW5kOwoKe9CS0YvQstC+0LTQuNGCINGA0LXQt9GD0LvRjNGC0LB9CnByb2NlZHVyZSBvdXRwdXQoTWluLCBIb3VycywgRGF5czppbnRlZ2VyKTsKYmVnaW4KICBpZiAoTWluID4gOSkgYW5kIChIb3VycyA+IDkpCiAgdGhlbgogICAgYmVnaW4KICAgICAgd3JpdGVsbihIb3VycywnIGhvdXJzIDogJyxNaW4sJyBtaW51dGVzJyk7CiAgICAgIHdyaXRlbG4oRGF5cywnIGRheXMnKTsKICAgIGVuZAogIGVsc2UKICAgIGlmIChNaW4gPiA5KSBhbmQgKEhvdXJzIDwgMTApCiAgICB0aGVuCiAgICAgIGJlZ2luCiAgICAgICAgd3JpdGVsbignMCcsSG91cnMsJyBob3VycyA6ICcsTWluLCcgbWludXRlcycpOwogICAgICAgIHdyaXRlbG4oRGF5cywnIGRheXMnKTsKICAgICAgZW5kCiAgICBlbHNlCiAgICAgIGlmICggTWluIDwgMTApIGFuZCAoSG91cnMgPCAxMCkKICAgICAgdGhlbgogICAgICAgIGJlZ2luCiAgICAgICAgICB3cml0ZWxuKCcwJyxIb3VycywnIGhvdXJzIDogJywnMCcsTWluLCcgbWludXRlcycpOwogICAgICAgICAgd3JpdGVsbihEYXlzLCcgZGF5cycpOwogICAgICAgIGVuZAogICAgICBlbHNlCiAgICAgICAgYmVnaW4KICAgICAgICAgIHdyaXRlbG4oSG91cnMsJyBob3VycyA6ICcsJzAnLE1pbiwnIG1pbnV0ZXMnKTsKICAgICAgICAgIHdyaXRlbG4oRGF5cywnIGRheXMnKTsKICAgICAgICBlbmQKZW5kOwoKYmVnaW4KICBpbnB1dChIb3RwLCBNb3RwLCBIcCwgTXApOwogIERheXM6PWdldERheXMoSHAsIE1wKTsKICBIb3Vyczo9Z2V0VGltZUgoSG90cCwgTW90cCwgSHAsIE1wKTsKICBNaW46PWdldFRpbWVNKE1vdHAsIE1wKTsKICBvdXRwdXQoTWluLCBIb3VycywgRGF5cyk7CiAgcmVhZGxuKCk7CmVuZC4gICAgICAgICAg