Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program lab_7_23
- use Environment
- implicit none
- Character(*), parameter :: input = "../data/input.txt", output = "output.txt"
- integer :: In = 0, Out = 0, N, M, max_value, i, j, k
- integer, allocatable :: A(:,:), B(:,:), C(:,:)
- integer, allocatable :: Ind(:,:), Indexes(:,:)
- logical, allocatable :: mask(:)
- open (file = input, newunit=In)
- read(In, *) N, M
- allocate(A(N,M))
- read(In, *) (A(i,:),i=1, N)
- close (In)
- write(*, "(4i3)") (A(i,:), i = 1, N)
- allocate(B(N, M-1))
- allocate(C(N-1, M-1))
- Indexes(:, 2) = [((j, i = 1, N-1), j = 1, M-1)]
- write(*,*) "Indexes is", Indexes
- !суммирование столбцов между собой
- do i = 1, M-1
- B(:,i) = A (:,i) + A(:,i+1)
- end do
- !Формируем матрицу всех миноров
- do i = 1, N-1
- C(i,:) = B(i,:) + B(i+1, :)
- end do
- deallocate(B)
- max_value = maxval(C)
- write(*,*) "C Array", C
- write(*,*) max_value
- allocate(mask((N-1)*(M-1)))
- mask = [C == max_value]
- allocate(Ind(Count(C .eq. 32),2))
- Ind(:, 1) = Pack(Indexes(:, 1), Mask)
- Ind(:, 2) = Pack(Indexes(:, 2), Mask)
- write(*,"(2i2)") Ind
- end program lab_7_23
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement