#include<stdio.h> #define max 999999; int main(){ int n, m, k, i, j,,s,x,y,z; int a[100][100]; while (scanf("%d%d%d", &n, &m, &k) != EOF) { for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (i == j) { a[i][j] = 0; } else { a[i][j] = max; } } } for (i = 0; i < m; i++) { scanf("%d%d%d", &x, &y,&z); a[x][y] = z; a[y][x] = z; } for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { for (s = 0; s < n; s++) { if (a[j][s] > a[j][i] + a[i][s]) { a[j][s] = a[j][i] + a[i][s]; } } } } for (i = 0; i < k; i++) { scanf("%d%d", &x, &y); printf("%d\n", a[x][y]); } } return 0; } /* Main.c: In function 'main': Main.c:4:20: error: expected identifier or '(' before ',' token int n, m, k, i, j,,s,x,y,z; ^ Main.c:18:21: error: 'x' undeclared (first use in this function) scanf("%d%d%d", &x, &y,&z); ^ Main.c:18:21: note: each undeclared identifier is reported only once for each function it appears in Main.c:18:25: error: 'y' undeclared (first use in this function) scanf("%d%d%d", &x, &y,&z); ^ Main.c:18:28: error: 'z' undeclared (first use in this function) scanf("%d%d%d", &x, &y,&z); ^ Main.c:24:10: error: 's' undeclared (first use in this function) for (s = 0; s < n; s++) { ^ */ |
Double click to view unformatted code.