Cod sursa(job #1459585)

Utilizator Patricia26Patricia-Georgiana Patricia26 Data 10 iulie 2015 12:00:29
Problema Jocul Flip Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.43 kb
var f,g:text;
    a:array[1..16,1..16] of integer;
    s,i,j,n,m,s1:integer;
 begin
  assign(f,'flip.in');reset(f);
  assign(g,'flip.out');rewrite(g);
  read(f,n,m);  s:=0; s1:=0;
  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+((-1)*a[i,j]);
  if a[i,j]<0 then s:=s+((-1)*a[i,j]);end;
  if s>abs(s1) then write(g,s)
               else write(g,abs(s1));
  close(f);
  close(g);
 end.