Cod sursa(job #33569)
Utilizator | Data | 19 martie 2007 15:13:46 | |
---|---|---|---|
Problema | Datorii | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<stdio.h>
int n,m,a[15001],x,y,ok;
int main()
{freopen("datorii.in","r",stdin);
freopen("datorii.out","w",stdout);
scanf("%d %d",&n,&m);
for(x=1;x<=n;x++)
{scanf("%d",&a[x]);
a[x]=a[x]+a[x-1];}
for(;m;m--)
{scanf("%d %d %d",&ok,&x,&y);
if(ok) printf("%d\n",a[y]-a[x])
else for(;x<=n;x++) a[x]=a[x]-y;}
return 0;}