Cod sursa(job #1452824)

Utilizator Patricia26Patricia-Georgiana Patricia26 Data 21 iunie 2015 21:15:49
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,max,max1,s1:integer;
 begin
  assign(f,'flip.in');reset(f);
  assign(g,'flip.out');rewrite(g);
  read(f,n,m);  s:=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.