const m=100; var i,j,k,n,d,x: integer; Goals: array[1..m,1..m]of integer; Teams: array[1..m]of string[15]; Score: array[1..m]of integer; List: set of byte; begin WriteLn('Type in team names one at a time, finish with empty line:'); n:=0; repeat Inc(n); Write(n,' => '); ReadLn(Teams[n]) until (n=m)or(Teams[n]=''); if Teams[n]='' then Dec(n); for i:=1 to n do for j:=1 to n do Goals[i,j]:=Random(6); WriteLn; WriteLn('The Cup table:'); Write('':15); for i:=1 to n do Write(i:5); WriteLn; for i:=1 to n do begin Write(Teams[i]:15,' ',i,' '); for j:=1 to n do if j>i then Write(Goals[i,j],':',Goals[j,i],' ') else Write('':5); WriteLn end; for i:=1 to n do begin Score[i]:=0; for j:=1 to n do begin d:=0; if Goals[i,j]>Goals[j,i] then d:=3 else if Goals[i,j]=Goals[j,i] then d:=2; Inc(Score[i],d) end end; WriteLn; WriteLn('Teams rating list:'); List:=[]; for i:=1 to n do begin x:=-1; for j:=1 to n do if not(j in List)and(Score[j]>x) then begin k:=j; x:=Score[j] end; List:=List+[k]; WriteLn(i:2,Teams[k]:16,Score[k]:5) end; ReadLn end.Буду очень благодарна!!!
Сообщение изменено: Альбиша (21 мая 2009 - 23:07 )