加油吧,诸位!

#include <stdio.h>

int main() {
    int m, n;
    int arr[101][101];
    while(scanf("%d %d", &m, &n) != EOF) {
        for (int i = 0; i < m; i++) {
            // 一边求和,一边找最大值
            int sum = 0, max_index = 0;
            for (int j = 0; j < n; j++) {
                scanf("%d", &arr[i][j]);
                sum += arr[i][j];
                if (j > 0 && arr[i][j] > arr[i][max_index]) {
                    max_index = j;
                }
            }
            arr[i][max_index] = sum;
        }
	  // 输出
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                printf("%d ", arr[i][j]);
            }
            printf("\n");
        }
    }
    return 0;
}