Pagini recente » Cod sursa (job #2631873) | Cod sursa (job #956435) | Cod sursa (job #163542) | Cod sursa (job #1516720) | Cod sursa (job #177644)
Cod sursa(job #177644)
program datorii;
var a:array [1..15000] of integer;
n,m,i,j,t,v,p,q,s:longint;
f,g:text;
c:byte;
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);
while not eof(f) do
begin
while not eoln(f) do
begin
read(f,c);
if c=0 then
begin
read(f,t,v);
a[t]:=a[t]-v;
end
else
begin
read(f,p,q);
s:=0;
for i:=p to q do
s:=s+a[i];
write(g,s);
writeln(g);
end;
end;
readln(f);
end;
close(f);
close(g);
end.