Cod sursa(job #149603)

Utilizator ghitza_2000Stefan Gheorghe ghitza_2000 Data 5 martie 2008 21:44:17
Problema Operatii Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.38 kb
    var j,z,i,x,y,n:longint;  
    numar:int64;  
    f,g:text;  
   begin  
    assign(f,'operatii.in');reset(f);  
   assign(g,'operatii.out');rewrite(g);  
   readln(f,n);  
   numar:=0;  
   x:=0;  
  for i:=1 to n do  
  begin  
  read(f,y);  
 z:=y-x;  
   if y>x then numar:=numar+z;  
   x:=y;  
   end;  
   write(g,numar);  
   close(f);  
  close(g);  
end.