Cod sursa(job #1088428)
| Utilizator | Data | 20 ianuarie 2014 15:33:04 | |
|---|---|---|---|
| Problema | Datorii | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
program datorii_1;
var n,m,i,j,s,x,y,z:longint;
a,v:array[1..20000] of longint;
b1,b2:array[1..1 shl 16] of char;
begin
assign(input,'datorii.in'); reset(input); settextbuf(input,b1);
assign(output,'datorii.out'); rewrite(output); settextbuf(output,b2);
readln(n,m);
for i:=1 to n do read(a[i]);
v[1]:=a[1];
for i:=2 to n do v[i]:=v[i-1]+a[i];
readln;
for i:=1 to m do
begin
readln(x,y,z);
if x=0 then for j:=y to n do dec(v[j],z)
else writeln(v[z]-v[y-1]);
end;
close(output);
end.
