#include<iostream>
using namespace std
;
int main(int argc
,char *argv
[]){
int a
[100][100];
int i
,j
;
int row
,clumn
;
int line
[100];
int col
[100];
int x
,y
;
int max
=0;
while(cin
>>row
>>clumn
){
for(i
=0;i
<row
;i
++){
for(j
=0;j
<clumn
;j
++){
cin
>>a
[i
][j
];
}
}
x
=0;
y
=0;
for(i
=0;i
<row
;i
++){
line
[i
]=0;
}
for(j
=0;j
<clumn
;j
++){
col
[i
]=0;
}
max
=row
>clumn
?row
:clumn
;
for(i
=0;i
<row
;i
++){
for(j
=0;j
<clumn
;j
++){
line
[i
]+=a
[i
][j
];
col
[j
]+=a
[i
][j
];
if(i
==j
) x
=x
+a
[i
][j
];
if(i
+j
== max
-1) y
=y
+a
[i
][j
];
}
}
for(i
=0;i
<row
;i
++){
cout
<<" "<<line
[i
];
}
cout
<<endl
;
for(j
=0;j
<clumn
;j
++){
cout
<<" "<<col
[j
];
}
cout
<<endl
;
cout
<<"x: "<<x
<<endl
;
cout
<<"y: "<<y
<<endl
;
}
return 0;
}
转载请注明原文地址: https://mac.8miu.com/read-513092.html