===== PascalABC.NET =====
begin
var n := ReadInteger('n =');
var a := ArrRandom(n, -99, 99);
a.Println;
Println('Результат:', (a.Max + a.Min) / 2)
end.
===== Turbo Pascal =====
program abcd;
uses Crt;
const
nn = 100;
var
i, n, max, min: integer;
a: array[1..nn] of integer;
begin
ClrScr;
Write('n = ');
Readln(n);
Randomize;
max := -32768;
min := 32767;
for i := 1 to n do
begin
a[i] := Random(199) - 99;
Write(a[i], ' ');
if a[i] > max then
max := a[i]
else if a[i] < min then
min := a[i]
end;
Writeln;
Writeln('Результат: ', (max + min) / 2);
ReadKey
end.
Const
N = 4;
Var
A:array[1..N,1..N] of integer;
i,j,k:integer;
Begin
Randomize;
WriteLn('1)');
k:=0;
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
A[i,j]:=random(21)-10;
Write(A[i,j]:3,' ');
if A[i,j] < 0 then k:=k+1;
End;
WriteLn
End;
WriteLn('k = ',k);
WriteLn('2)');
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
if j > i then A[i,j]:=100;
Write(A[i,j]:3,' ')
End;
WriteLn
End;
WriteLn('3)');
For i:= 1 to N div 2 do
Begin
For j:= 1 to N do
Begin
k:=A[i+N div 2,j];
A[i+N div 2,j]:=A[i,j];
A[i,j]:=k;
End
End;
For i:= 1 to N do
Begin
For j:= 1 to N do
Write(A[i,j]:3,' ');
WriteLn
End;
End.
1)
10 2 -9 4
-10 5 -5 -10
4 9 4 10
3 -9 10 -6
k = 6
2)
10 100 100 100
-10 5 100 100
4 9 4 100
3 -9 10 -6
3)
4 9 4 100
3 -9 10 -6
10 100 100 100
-10 5 100 100
Любой хост сети с IP-адресом 192.131.122.0
Вычисляем по формулам:
N = 2^b
I = k*b
Где N - мощность алфавита, b - инф. вес символов, k - количество символов
Отсюда,
128 = 2^b
b = 6
12 кб = 98304 бит
98304 = k * 6
k = 16384