增高防护塔
include<stdio.h>
main()
{int n,d[100],m,i,j,a,b,c;
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d",&d[i]);}
scanf("%d",&m);
while(m--)
{scanf("%d%d%d",&a,&b,&c);
for(j=a-1;j<b;j++)
{d[j]+=c;}}
for(i=0;i<n;i++)
{printf("%d ",d[i]);}}
main()
{int n,d[100],m,i,j,a,b,c;
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d",&d[i]);}
scanf("%d",&m);
while(m--)
{scanf("%d%d%d",&a,&b,&c);
for(j=a-1;j<b;j++)
{d[j]+=c;}}
for(i=0;i<n;i++)
{printf("%d ",d[i]);}}
相关推荐