{Attention! Это самое отвратное моё решение на Знаниях. Запаситесь валерьянкой перед прочтением кода} //Pascal ABC.NET 3.1 сборка 1219
Type ty=record valu:integer; count:integer; end;
Const n=3;
Var ma:array[1..n,1..n] of integer; tyar:array of ty; se:set of integer; i,j,z,k,MaxCount:integer; begin randomize; se:=[]; k:=0; MaxCount:=integer.MinValue; writeln('Matrix:'); for i:=1 to n do begin for j:=1 to n do begin ma[i,j]:=random(-10,10); write(ma[i,j]:4); if not(ma[i,j] in se) then begin inc(k); setlength(tyar,k+1); tyar[k].valu:=ma[i,j]; tyar[k].count:=1; se:=se+[ma[i,j]]; end else for z:=1 to k do {O(n^3) в худшем случае - нормальные люди ненавидят это} if tyar[z].valu=ma[i,j] then begin inc(tyar[z].count); break; end; end; writeln; end; for i:=1 to k do if MaxCount<tyar[i].count then MaxCount:=tyar[i].count; writeln('Res:'); for i:=1 to k do if tyar[i].count=MaxCount then writeln(tyar[i].valu); end.
Пример работы программы: Matrix: -7 -2 10 8 0 -2 6 10 1 Res: -2 10
var a,b,c:array[10..99] of integer;
ast,bst,cst:string;
i:integer;
begin
ast:='A:';
bst:='Б:';
cst:='В:';
for i:=10 to 99 do
begin
c[i]:=i;
a[i]:=c[i]-i+random(50);
b[i]:=c[i]-a[i];
ast:=ast+' '+inttostr(a[i]);
bst:=bst+' '+inttostr(b[i]);
cst:=cst+' '+inttostr(c[i]);
end;
setpencolor(clRed);
line(0,0,150,0);
line(150,0,75,50);
line(75,50,0,0);
rectangle(0,50,150,300);
DrawTextCentered(0,50,150,300,ast);
setpencolor(clYellow);
line(150,0,300,0);
line(300,0,225,50);
line(225,50,150,0);
rectangle(150,50,300,300);
DrawTextCentered(150,50,300,300,bst);
setpencolor(clGreen);
line(300,0,450,0);
line(450,0,375,50);
line(375,50,300,0);
rectangle(300,50,450,300);
DrawTextCentered(300,50,450,300,cst);
end.