Pagini recente » Cod sursa (job #550230) | Cod sursa (job #853581) | Cod sursa (job #551534) | Cod sursa (job #171704) | Cod sursa (job #525572)
Cod sursa(job #525572)
var a:array[1..15000] of integer;
n,m,t,v,p,q:longint;
f:text;
procedure suma(left,right:longint);
var i,s:longint;
begin
s:=0;
for i:=left to right do
s:=s+a[i];
writeln(f,s);
end;
procedure citire;
var t:text;
i,j,x,y:longint;
begin
assign(t,'datorii.in');
reset(t);
readln(t,n,m);
for i:=1 to n do
read(t,a[i]);
for i:=1 to m do
begin
readln(t,j,x,y);
if j=1 then suma(x,y)
else a[x]:=a[x]-y;
end;
end;
begin
assign(f,'datorii.out');
rewrite(f);
citire;
close(f);
end.