uses graph; const pikkus=800; var i, d, n, m, aeg, valaeg, ajad,t, hilaeg :integer; kiirus: real; s: string; p: array[1..9] of integer; begin ajad:=0; hilaeg:=0; randomize; n:=300; for i:=1 to 300 do begin valaeg:=random(181); if valaeg>120 then kiirus:=5/3; if valaeg<=120 then kiirus:=10/9+5/9*random; aeg:=round(pikkus/kiirus)+valaeg+random(31); case aeg of 480..509 : inc (p[1]); 510..539 : inc (p[2]); 540..569 : inc (p[3]); 570..599 : inc (p[4]); 600..629 : inc (p[5]); 630..659 : inc (p[6]); 660..689 : inc (p[7]); 690..719 : inc (p[8]); 720..749 : inc (p[9]); end; if ((valaeg>120) and (aeg>420) and (aeg<480)) or ((valaeg<=120) and (aeg>480) and (aeg<601)) then ajad:=ajad+1; if((valaeg>120)and (aeg>420) and (aeg<540)) or ((valaeg<=120) and (aeg>=480) and (aeg<660)) then hilaeg:=hilaeg+1; end; for i:=1 to 9 do writeln(p[i]); d:=detect; initgraph (d, m, ''); for i:=1 to 10 do begin bar (40+60*i, 400-(p[i]*4), 75+60*i, 400); end; aeg:=0; while (aeg<=80) do begin str(aeg:2, s); outtextxy(1, 400-aeg*4, s); aeg:=aeg+10; end; settextstyle (DefaultFont, VertDir, 1); aeg:=480; while (aeg<=750) do begin str(aeg:2, s); outtextxy (110+2*(aeg-490), 400, s); aeg:=aeg+30; end; settextstyle (DefaultFont, HorizDir, 1); t:=round(100/n*ajad); str(t:2, s); outtextxy(1, 430,'Laps jouab kooli oigeks ajaks'); outtextxy(1, 440, s+ ' protsendil kordadest'); t:=round (100/n*hilaeg); str(t:2, s); outTextxy(1,450, 'opilane hilineb vahem kui uhe minuti' ); outtextxy(1,460, s+ ' protsendil kordadest'); readln; closegraph; end.