这俩程序块有啥区别呢?上面的对,下面的错???
int n,m,q;
scanf("%d%d%d",&n,&m,&q);
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
scanf("%d",&s[i][j]);
a[i][j]+=s[i][j];
a[i][j+1]-=s[i][j];
a[i+1][j]-=s[i][j];
a[i+1][j+1]+=s[i][j];
}
}
#include<iostream>
using namespace std;
const int N=1010;
int s[N][N],a[N][N];
int main(){
int n,m,q;
scanf("%d%d%d",&n,&m,&q);
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
scanf("%d",&a[i][j]);
//a[i][j]+=s[i][j];
a[i][j+1]-=a[i][j];
a[i+1][j]-=a[i][j];
a[i+1][j+1]+=a[i][j];
}
}
//差分矩阵已经构造好
int x1,y1,x2,y2,c;
while(q--){
scanf("%d%d%d%d%d",&x1,&y1,&x2,&y2,&c);
a[x1][y1]+=c;
a[x2+1][y2+1]+=c;
a[x1][y2+1]-=c;
a[x2+1][y1]-=c;
}
//询问已经结束
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
s[i][j]=a[i][j]+s[i-1][j]+s[i][j-1]-s[i-1][j-1];
printf("%d ",s[i][j]);
}
printf("\n");
}
return 0;
}