Pagini recente » Cod sursa (job #399687) | Cod sursa (job #1102194) | Cod sursa (job #2946272) | Cod sursa (job #1382762) | Cod sursa (job #599909)
Cod sursa(job #599909)
const fin = 'operatii.in'; fout = 'operatii.out';
type
buffer = array[1..1 shl 17] of char;
var
bufin, bufout : buffer;
procedure main();
var
n ,i ,a ,b ,sol : longword;
begin
assign( input, fin ); reset( input );
assign( output, fout ); rewrite( output );
settextbuf( input, bufin );
settextbuf( output, bufout );
a := 0; b := 0; sol := 0;
readln( n );
for i := 1 to n do
begin
a := b;
read( b );
if (b > a) then sol := sol + (b - a);
end;
write( sol , #10 );
end;
begin
main();
end.