Код PascalABC 3.0uses GraphABC, Crt;Varx,y,t,v1,v2:integer;C:word;BeginWrite('Введите время работы светофора: ');ReadLn(t);Write('Введите скорость зелёной машины: ');ReadLn(v1);Write('Введите скорость красной машины: ');ReadLn(v2);LockDrawing;RepeatClearWindow;Case (C div t) mod 3 of0:SetBrushColor(clGreen);1:SetBrushColor(clYellow);2:SetBrushColor(clRed);End;Circle(-30+(WindowWidth div 2),-40+(WindowHeight div 2),10);Case (C div t) mod 3 of2:SetBrushColor(clGreen);1:SetBrushColor(clYellow);0:SetBrushColor(clRed);End;Circle(-40+(WindowWidth div 2),30+(WindowHeight div 2),10);if C<65535 then C:=C+1else C:=0;SetBrushColor(clMedGray);FillRect(0,20+(WindowHeight div 2),WindowWidth,-20+(WindowHeight div 2));FillRect(20+(WindowWidth div 2),0,-20+(WindowWidth div 2),WindowHeight);SetBrushColor(clGreen);FillRect(-13+(WindowWidth div 2),-40+y,13+(WindowWidth div 2),y);if ((x+v1<=(WindowWidth div 2)-20)or(x-40>=(WindowWidth div 2)+20)) then x:=x+v1else Begin if ((y-40>=20+(WindowHeight div 2))or(y<=(WindowHeight div 2)-20)) then Begin if ((C div t) mod 3 = 2)or(x>(WindowWidth div 2)-20) then x:=x+v1 End End;if x>=WindowWidth+40 then x:=0;SetBrushColor(clRed);FillRect(-40+x,13+(WindowHeight div 2),x,-13+(WindowHeight div 2));if (y+v2<=(WindowHeight div 2)-20)or(y-40>=(WindowHeight div 2)+20) then y:=y+v2else Begin if (x-40>=20+(WindowWidth div 2))or(x<=(WindowWidth div 2)-20) then Begin if ((C div t) mod 3 = 0)or(y>(WindowHeight div 2)-20) then y:=y+v2 End End;if y>=WindowHeight+40 then y:=0;RedrawUntil false;End.