Cod sursa(job #116350)

Utilizator bogdan88Bogdan Popescu bogdan88 Data 18 decembrie 2007 14:36:05
Problema Operatii Scor 80
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.38 kb
var fi,fo:text;
    n,i,j,max,ct:longint;
    v:array[0..1000000]of longint;
begin
  assign(fi,'operatii.in'); reset(fi);
  assign(fo,'operatii.out'); rewrite(fo);
  readln(fi,n);
  max:=-maxint;
  ct:=0;
  for i:=1 to n do
    begin
      read(fi,v[i]);
      if v[i]>v[i-1] then
         inc(ct,v[i]-v[i-1]);
    end;
  writeln(fo,ct);
  close(fi);
  close(fo);
end.