Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rem Attribute VBA_ModuleType=VBADocumentModule
- Option VBASupport 1
- Sub qq()
- Dim a(), m, n As Integer
- Dim counterZero, totalCounter As Integer
- Dim NumberN As Integer
- Dim masodin() As Integer
- n = CInt(InputBox("Введите размерность строк:"))
- m = CInt(InputBox("Введите размерность столбцов:"))
- ReDim a(n, m)
- Selection.TypeText ("Матрица:" + Chr(13))
- For i = 1 To n
- For j = 1 To m
- a(i, j) = CInt(Rnd() * 100) - 50
- Selection.TypeText (CStr(a(i, j)) + Chr(9))
- Next j
- Selection.TypeParagraph
- Next i
- Selection.TypeParagraph
- counterZero = 0
- totalCounter = 0
- For i = 1 To n
- For j = 1 To m
- If (a(i, j) = 0) Then
- counterZero = counterZero + 1
- End If
- Next j
- If (counterZero = 0) Then
- totalCounter = totalCounter + 1
- counterZero = 0
- End If
- Next i
- Dim NumberProv As Integer
- NumberN = 0
- NumberProv = 0
- For i = 1 To m
- For j = 1 To n
- If (a(i, j) > 0 And NumberProv = 0) Then
- NumberN = i
- NumberProv = 1
- Exit For
- End If
- Next j
- Next i
- Dim t, t1, r, t2 as Integer
- Dim k, f As Integer
- r = 0
- for i = 0 To n
- for j = 0 to n
- t2=a(i,j)
- a(i,j)=0
- for k = 0 To n
- for f = 0 To n
- if(t2 = a(k,f)) then
- t = a(k,f)
- end if
- if(t2 <> a(k,f)) then
- r=r+1
- end if
- Next f
- if(t1>t) then
- t = t1
- end if
- Next k
- t1=t
- a(i,j)=t2
- Next j
- Next i
- Selection.TypeText ("Кол-во строк без 0: " + Str(totalCounter))
- Selection.TypeParagraph
- Selection.TypeText ("Номер первой из строк, содержащих хотя бы один положительный элемент: " + Str(NumberN))
- Selection.TypeParagraph
- Selection.TypeText ("max из чисел встречающихся в матрице более 1 раза: " + Str(t))
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement