Опишите что здесь происходит?
Private Sub OptionButton1_Click()
For i = 1 To 10000
Cells(i, 5) = ""
If Cells(i, 1) = "" Then
n = i - 1
Exit For
End If
Next i
For i = 2 To n
For j = i + 1 To n
If Cells(i, 4) < Cells(j, 4) Then
t = Cells(i, 1)
Cells(i, 1) = Cells(j, 1)
Cells(j, 1) = t
t1 = Cells(i, 2)
Cells(i, 2) = Cells(j, 2)
Cells(j, 2) = t1
t2 = Cells(i, 3)
Cells(i, 3) = Cells(j, 3)
Cells(j, 3) = t2
t3 = Cells(i, 4)
Cells(i, 4) = Cells(j, 4)
Cells(j, 4) = t3
End If
Next j
Next i
End Sub
Var
ma:array of array of integer;
i,j,n,r:integer;
begin
readln(n);
setlength(ma,n+1);
for i:=1 to n do
setlength(ma[i],n+1);
writeln('Matrix:');
for i:=1 to n do
begin
writeln;
for j:=1 to n do
begin
ma[i,j]:=random(n);
write(ma[i,j]:4);
end;
end;
for i:=1 to n do
for j:=i+1 to n do
r:=r+ma[i,j];
r:=r div 3;
writeln;
if odd(r) then writeln('Да') else writeln('Нет');
end.
Пример ввода:
4
Пример вывода:
Matrix:
0 1 3 3
3 0 0 3
2 3 0 2
3 0 2 3
Нет
Var
ma:array of array of integer;
i,j,n,r:integer;
begin
readln(n);
setlength(ma,n+1);
for i:=1 to n do
setlength(ma[i],n+1);
writeln('Matrix:');
for i:=1 to n do
begin
writeln;
for j:=1 to n do
begin
ma[i,j]:=random(n);
write(ma[i,j]:4);
end;
end;
for i:=1 to n do
for j:=i+1 to n do
r:=r+ma[i,j];
r:=r div 3;
writeln;
if odd(r) then writeln('Да') else writeln('Нет');
end.
Пример ввода:
4
Пример вывода:
Matrix:
0 1 3 3
3 0 0 3
2 3 0 2
3 0 2 3
Нет