Pagini recente » Cod sursa (job #905134) | Cod sursa (job #2464243) | Cod sursa (job #1743292) | Cod sursa (job #2327956) | Cod sursa (job #6270)
Cod sursa(job #6270)
var cod,n,m,i,j,sum,x,y:longint;
a:array[1..15000] of longint;
f,g:text;
begin
assign(f,'datorii.in');
assign(g,'datorii.out');
reset(f);
rewrite(g);
readln(f,n,m);
for i:=1 to n do read(f,a[i]);
readln(f);
for i:=1 to m do begin
read(f,cod,x,y);
if not m=i then readln(f);
if cod=0 then a[x]:=a[x]-y;
if cod=1 then begin
sum:=0;
for j:=x to y do inc(sum,a[j]);
writeln(g,sum);
end;
end;
close(f);
close(g);
end.