Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  12
Language: PASCAL
Code:
Program laba;
uses crt;
var
i,j,N,T,Toy,min,nomer:integer;
post:array [1..480] of integer;
dl:array [1..480] of integer;
begin
clrscr;
randomize;
writeln('vvedite kol-vo kanalov');
readln(N);
post [1]:=random(9)+1;
for i:=2 to 480 do
begin
post[i]:=post[i-1]+random(9)+1;
end;
for i:=1 to N do
dl[i]:=0;
T:=0;
i:=0;
Toy:=0;
dl[1]:=post[1]+random(19)+1;
writeln;
writeln('massiv postyplenie zayavok');
for i:=1 to 30 do
write(',',post[i]);
writeln;
min:=dl[1];
i:=0;
while T<=480 do
begin
i:=i+1;
for j:=1 to N do
begin if min>dl[j] then
begin
min:=dl[j];
nomer:=j;
end;
end;
if post [i]<min then
begin
dl[nomer]:=min+random(19)+1;
Toy:=Toy+(min-post[i]);
T:=dl[nomer];
min:=dl[nomer];
end;
begin
dl[nomer]:=post[i]+random(19)+1;
T:=dl[nomer];
min:=dl[nomer];
end;
end;
j:=0;
while post [j]<480 do j:=j+1;
writeln;
writeln('kol-vo postupiv zayavok',j);
writeln('kol-vo obslyj zayavok',i);
writeln('srednee vremya ojidaniya',Toy/j:2:7);
writeln('summarnoe vremya ojidaniya',Toy);
readln
end.
Comments: