#include #include int main() { int n; scanf("%d", &n); double mat[101][101]; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { scanf("%lf", &mat[i][j]); } } double X = 0.0, Y = 0.0; for(int i = 0; i < n; i++) { for(int j = 0; j < i; j++) { X += mat[i][j]; } } for(int i = 0; i < n; i++) { for(int j = n - i; j < n; j++) { Y += mat[i][j]; } } double B[101][101]; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { B[i][j] = 0.0; } } for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(i == j) { B[i][j] = X; } } } for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(i + j == n - 1) { B[i][j] = Y; } } } if(n % 2 == 1) { B[n / 2][n / 2] = X + Y; // ako elementot pripaga i na dvete dijagonali } for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { printf("%f ", B[i][j]); } printf("\n"); } return 0; } /* 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */