program check_rows
implicit none
integer, parameter :: rows = 10, cols = 10
integer :: A(rows, cols)
integer :: i, j
logical :: found
! 初始化数组A,这里假设使用一些随机数或其他方式赋值,此处简单设为0
A = 0
found =.false.
do i = 1, rows - 2
logical :: all_ones
all_ones =.true.
do j = 1, cols
if (A(i, j) /= 1) then
all_ones =.false.
exit
end if
end do
if (all_ones) then
all_ones =.true.
do j = 1, cols
if (A(i + 1, j) /= 1) then
all_ones =.false.
exit
end if
end do
if (all_ones) then
all_ones =.true.
do j = 1, cols
if (A(i + 2, j) /= 1) then
all_ones =.false.
exit
end if
end do
if (all_ones) then
found =.true.
exit
end if
end if
end if
end do
if (found) then
print *, '存在连续三行全为1'
else
print *, '不存在连续三行全为1'
end if
end program check_rows