[Fortran] 纯文本查看 复制代码 Program www_fcode_cn
Implicit None
Integer , parameter :: N = 15749!// 行
Integer , parameter :: N_rows = N !// 行
Integer :: idata( 2 , N ) , idata_row( 2 , N )
Integer :: currRow , i , j , k
Logical :: b( 2 )
currRow = 0
Open( 12 , File = "Number.txt" )
Open( 13 , File = "Number1.txt" )
Do i = 1 , N
Read( 12 , * ) idata( : , i )
j = 0
b = .false.
Do j = 1 , i-1
b(1) = ( any( idata(1,i) == idata(:,j) ) )
b(2) = ( any( idata(2,i) == idata(:,j) ) )
if ( any(b) ) exit
End Do
if ( j > 0 .and. j <= i-1 ) then
if( b(1) .and. .NOT.b(2) ) then
idata_row( 1 , i ) = 0
idata_row( 2 , i ) = idata_row( 1 , j )
elseif( b(2) .and. .NOT.b(1) ) then
idata_row( 2 , i ) = 0
idata_row( 1 , i ) = idata_row( 2 , j )
else
idata_row( : , i ) = 0
end if
else
currRow = currRow + 1
idata_row( : , i ) = currRow
end if
End Do
Do i = 1 , currRow
Do j = 1 , N
if ( idata_row(1,j) == i ) then
write( 13 , '(g0,1x)' , advance='no' ) idata(1,j)
end if
if ( idata_row(2,j) == i ) then
write( 13 , '(g0,1x)' , advance='no' ) idata(2,j)
end if
End Do
write(13,*)
End Do
Close( 12 )
Close( 13 )
End Program www_fcode_cn |