Pagini recente » Cod sursa (job #1697774) | Cod sursa (job #2809038) | Cod sursa (job #1697167) | Cod sursa (job #524344) | Cod sursa (job #2314555)
program cc; type tabel=array[1..1000]of longint;
var a,b,c,n,y,j,i,k,m,x:longint; t:tabel;
begin
assign(input,'datorii.in');assign(output,'datorii.out');
reset(input);rewrite(output);
readln(n,m);
for i:=1 to n do read(t[i]);
for j:=1 to m do begin
readln(a,b,c);x:=0;
if a=1 then begin
for i:=b to c do x:=x+t[i]; writeln(x);end;
if a=0 then t[b]:=t[b]-c;end;
close(input);close(output);
end.