Pagini recente » Cod sursa (job #1944515) | Cod sursa (job #2450423) | Cod sursa (job #2301267) | Cod sursa (job #2445022) | Cod sursa (job #1459590)
var f,g:text;
a:array[1..16,1..16] of integer;
s,i,j,n,m,s1,com:integer;
begin
assign(f,'flip.in');reset(f);
assign(g,'flip.out');rewrite(g);
read(f,n,m); s:=0; s1:=0;com:=-1;
for i:=1 to n do
for j:=1 to m do begin read(f,a[i,j]);
if a[i,j]>0 then s1:=s1+(com*a[i,j]);
if a[i,j]<0 then s:=s+(com*a[i,j]);end;
if s>abs(s1) then write(g,s)
else write(g,abs(s1));
close(f);
close(g);
end.