Pagini recente » Cod sursa (job #1501283) | Cod sursa (job #780051) | Cod sursa (job #2865878) | Cod sursa (job #1373470) | Cod sursa (job #525731)
Cod sursa(job #525731)
var a:array[1..100]of integer;
c:array[1..16,1..16]of longint;
n,m:integer; max:longint; f:text;
procedure citire;
var i,j:byte;f:text;
begin
assign(f,'flip.in');
reset(f);
readln(f,n,m);
for i:=1 to n do
for j:=1 to m do read(f,c[i,j]);
close(f);
max:=0;
end;
procedure aras;
var i,j,h:integer; s,k:int64;
begin
s:=0;
for i:=1 to n do
begin
k:=0;
for j:=1 to m do begin k:=k+c[i,j]*a[j]; end;
s:=s+abs(k);
end;
if s>max then max:=s;
end;
procedure afis;
var f:text;
begin
assign(f,'flip.out');
rewrite(f);
writeln(f,max);
close(f);
end;
procedure gen_bin(p:byte);
begin
if p>m then aras
else begin
a[p]:=-1; gen_bin(p+1);
a[p]:=1; gen_bin(p+1);
end;
end;
begin
citire;
gen_bin(1);
afis;
end.