Tiêu đề: bai 9: vu hoai bang Mon Dec 26, 2022 9:14 pm
Code:
var a:array[1..1000,1..1000] of longint; h,c:array[1..1000] of longint; n,m,i,j,t:longint; begin assign(input,'bai3onl.inp');reset(input); assign(output,'bai3onl.out');rewrite(output); read(n,m); for i:=1 to n do for j:=1 to m do read(a[i,j]); for i:=1 to n do begin t:=0; for j:=1 to m do t:=t+a[i,j]; h[i]:=t; end; for j:=1 to m do begin t:=0; for i:=1 to n do t:=t+a[i,j]; c[j]:=t; end; for i:=1 to n do write(h[i],' '); writeln; for j:=1 to m do write(c[j],' '); close(input);close(output); end.