Pagini recente » Cod sursa (job #1932558) | Cod sursa (job #890290) | Cod sursa (job #1654647) | Cod sursa (job #1727240) | Cod sursa (job #528391)
Cod sursa(job #528391)
var a:array[1..1500]of int64;
b:array[1..1500]of int64;
n,m,i,j:longint;z,x,y,p,c,k:int64; f,t:text;
begin
assign(f,'datorii.in');
reset(f);
assign(t,'datorii.out');
rewrite(t);
readln(f,n,m);
k:=0;
for i:=1 to n do begin read(f,c); k:=k+c; a[i]:=k; b[i]:=0; end;
readln(f);
for i:=1 to m do
begin
readln(f,x,y,z);
if x=0 then b[y]:=b[y]+z else
if x=1 then
begin
p:=0;
for j:=y to z do p:=p+b[j];
k:=a[z]-a[y-1]-p;
writeln(t,k);
end;
end;
close(f);
close(t);
end.