Cod sursa(job #183648)
Utilizator | Data | 22 aprilie 2008 13:45:35 | |
---|---|---|---|
Problema | Operatii | Scor | 10 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
program operatii;
var n,i,a,max,op: longint;
f: text;
begin
assign(f,'operatii.in');
reset(f);
readln(f,n);
for i:=1 to n do
begin
read(f,a);
if a>max then
max:=a;
if a=0 then
begin
op:=op+max;
max:=0;
end;
end;
op:=op+max;
close(f);
assign(f,'operatii.out');
rewrite(f);
write(f,op);
close(f);
end.