Program Test
Implicit None
Integer, Parameter :: M = 6, N = 5
Integer G(N, M), W(N, N), I, J, K
G = reshape( (/ -1, 0, 0, 0, 0,&
1, -1, 0, 0, 0,&
0, 1, -1, 0, 0,&
0, 0, 1, -1, -1,&
0, 0, 0, 1, 0,&
0, 0, 0, 0, 1/), (/n,m/) )
W = 0
Do I = 1, N
Do J = 1, M
If (G(I,J)==1) Then
Do K = 1, N
If (G(K,J)==-1) W(K, I) = 1
End Do
Exit
End If
End Do
End Do
Write (*, '(5i4)') W
! 0 1 0 0 0
! 0 0 1 0 0
! 0 0 0 1 1
! 0 0 0 0 0
! 0 0 0 0 0
End Program Test
li913 发表于 2015-1-13 20:29
[mw_shl_code=fortran,true]Program Test
Implicit None
Integer, Parameter :: M = 6, N = 5
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |