Pagini recente » Cod sursa (job #2671888) | Cod sursa (job #1780725) | Cod sursa (job #1115512) | Cod sursa (job #961794) | Cod sursa (job #251049)
Cod sursa(job #251049)
var f,g:text;
c,v:array[1..15000] of longint;
n,m,i,j,x,s,y,p:longint;
begin
assign(f,'datorii.in');
reset(f);
assign(g,'datorii.out');
rewrite(g);
readln(f,n,m);
for i:=1 to n do
begin
read(f,v[i]);
c[i]:=c[i-1]+v[i];
end;
for i:=1 to m do
begin
readln(f,p,x,y);
if p=1 then
begin
s:=c[y]-c[x-1];
writeln(g,s);
end
else for j:=x to n do
c[j]:=c[j]-y;
end;
close(g);
end.