Pagini recente » Cod sursa (job #2023854) | Cod sursa (job #750972) | Diferente pentru utilizator/mathboy intre reviziile 57 si 56 | Cod sursa (job #2953651) | Cod sursa (job #1488722)
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("datorii.in");
ofstream out("datorii.out");
int V[15001];
int main()
{
int n,m,v,t,i,x,d;
in>>n>>m;
for(i=1;i<=n;i++)
in>>V[i];
for(i=1;i<=m;i++)
{
in>>x>>t>>v;
if(x==0)
V[t]-=v;
else
if(x==1)
{
d=0;
while(t<=v)
{
d+=V[t];
t++;
}
out<<d<<"\n";
}
}
return 0;
}