#include #include #include #include #include #include #include int min(int a, int b){ return (a < b ? a : b); } void resolvable(int i, int j, int n, int **map, int coup){ int x = 0; int di = 0; int y; if (map[n-1][n-1]!=-1) return ; while (x < n){ y = 0; while (y < n){ if (map[x][y]==coup){ int dx = 0; int dy; while(dx 0) resolvable(i, j, n, map,coup + 1); return ; } int resolve(int i, int j, int n) { int **map = malloc(sizeof(int*)*n); for (int x = 0; x < n; x++){ map[x] = malloc(sizeof(int)*n); for (int y = 0; y < n; y++){ map[x][y] = -1; } } map[0][0] = 0; resolvable(i,j,n,map,0); return(map[n-1][n-1]); } int main(){ int n; scanf("%d",&n); int **result = malloc(sizeof(int*)*n); for (int x = 0; x < n; x++){ result[x] = malloc(sizeof(int)*n); for (int y = 0; y < n; y++){ result[x][y] = 0; } } for (int i = 1; i < n; i++){ for (int j = i; j < n; j++) { result[i][j] = resolve(i, j, n); result[j][i] = result[i][j]; } } for (int i = 1; i < n; i++){ for (int j = 1; j < n; j++) { printf("%d", result[i][j]); if(j < n - 1){ printf(" "); } } printf("\n"); } return 0; }