#include<stdio.h> int main() { int n, t; int a, b, value; int w, e; int c, d; while (scanf("%d %d", &n, &t) != EOF && !(n == 0 && t == 0)) { int x[n+1][n + 1] = { 0 }; int y[n + 1][n + 1] = { 0 }; int sum = 0; int res = 0; int count = 0; while (t--) { scanf("%d %d %d", &a, &b, &value); if (value < x[a][b]||x[a][b]==0) { x[a][b] = value; } if (value < x[b][a] || x[b][a] == 0) { x[b][a] = value; } } scanf("%d %d", &w, &e); while (w--) { scanf("%d %d", &c, &d); if (!y[c][d]) { y[c][d] = 1; y[d][c] = 1; sum += x[c][d]; } if (d == e) { res = sum; } } count++; printf("Case #%d: %d\n", count, res); } } /* Main.c: In function 'main': Main.c:9:3: error: variable-sized object may not be initialized int x[n+1][n + 1] = { 0 }; ^~~ Main.c:9:25: warning: excess elements in array initializer int x[n+1][n + 1] = { 0 }; ^ Main.c:9:25: note: (near initialization for 'x[0]') Main.c:9:3: warning: excess elements in array initializer int x[n+1][n + 1] = { 0 }; ^~~ Main.c:9:3: note: (near initialization for 'x') Main.c:10:3: error: variable-sized object may not be initialized int y[n + 1][n + 1] = { 0 }; ^~~ Main.c:10:27: warning: excess elements in array initializer int y[n + 1][n + 1] = { 0 }; ^ Main.c:10:27: note: (near initialization for 'y[0]') Main.c:10:3: warning: excess elements in array initializer int y[n + 1][n + 1] = { 0 }; ^~~ Main.c:10:3: note: (near initialization for 'y') */ |
Double click to view unformatted code.