File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -41,17 +41,18 @@ public A(boolean stdIO)throws FileNotFoundException{
41
41
out = new PrintWriter (outputStream );
42
42
}
43
43
44
+ final int MAX_N = 100 ;
45
+ long cost [][] = new long [MAX_N + 1 ][MAX_N + 1 ];
46
+ long w [][] = new long [MAX_N + 1 ][MAX_N + 1 ];
47
+
48
+
44
49
void run ()throws Exception {
45
50
int n = i ();
46
51
int ans = 0 ;
47
52
48
53
out .write ("" +ans +"\n " );
49
54
50
55
}
51
-
52
- final int MAX_N = 100 ;
53
- long cost [][] = new long [MAX_N + 1 ][MAX_N + 1 ];
54
- long w [][] = new long [MAX_N + 1 ][MAX_N + 1 ];
55
56
56
57
57
58
void clear (){
@@ -71,14 +72,13 @@ void allPairShortestPath(int n){
71
72
}
72
73
// order matters: k->i->j
73
74
for (int k = 1 ; k <= n ; k ++){
74
- for (int i = 1 ; i <= n ; i ++){
75
- for (int j = 1 ; j <= n ; j ++){
76
-
77
- if (cost [i ][k ] + cost [k ][j ] < cost [i ][j ]){
78
- cost [i ][j ] = cost [i ][k ] + cost [k ][j ];
79
- }
80
- }
75
+ for (int i = 1 ; i <= n ; i ++){
76
+ for (int j = 1 ; j <= n ; j ++){
77
+ if (cost [i ][k ] + cost [k ][j ] < cost [i ][j ]){
78
+ cost [i ][j ] = cost [i ][k ] + cost [k ][j ];
79
+ }
81
80
}
81
+ }
82
82
}
83
83
}
84
84
You can’t perform that action at this time.
0 commit comments