标签:style blog class code java ext
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 |
<span style= "font-family: courier new,courier; font-size: 14px;" > public
class Demo { public
static void foo( int [][] A) { int
n = A. length; for
( int k = 0 ; k < n; k++) { for
( int i = 0 ; i < n; i++) { for
( int j = 0 ; j < n; j++) { A[i][j] = A[i][j]|(A[i][k]&A[k][j]); } } } } public
static void print( int [][] A){ for
( int i = 0 ; i < A. length; i++) { for
( int j = 0 ; j < A. length; j++) { System. out. print(A[i][j]+ "\t" ); } System. out.println(); } } public
static void main(String[] args) { int [][] A = { { 0 , 1 , 0 , 0 , 0
}, { 0 , 0 , 1 , 0 , 0
}, { 0 , 0 , 0 , 0 , 0
}, { 0 , 0 , 0 , 0 , 1
}, { 0 , 0 , 0 , 1 , 1
} }; System. out.println( "最初的关系矩阵:"
); print(A); foo(A); System. out.println( "结果矩阵:"
); print(A); } } </span> |
标签:style blog class code java ext
原文地址:http://www.cnblogs.com/ZhangJinkun/p/3719553.html