/前缀和二维
int main(){
int a[100][100],s[100][100];//可以更改,
for(int i=1;i<100;i++)
for(int j=1;j<100;j++)//输入矩阵a[0][0]空出来
scanf("%d",&a[i][j]);
for(int i=1;i<100;i++)
for(int j=1;j<100;j++)
s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+a[i][j];
//输出区间(l1,r2) (l2,r2)之间的面积(抽象)
int l1,l2,r1,r2;
scanf("%d%d%d%d",&l1,&l2,&r1,&r2);
int ans=0;
ans=s[l2][r2]-s[l1-1][r2]-s[l2][r1-1]+s[l1-1][r1-1];//求差值
printf("%d",ans);
}//
//差分一维二维
int a[100], b[100];
void insert(int l,int r,int c){
b[l]+=c;
b[r+1]-=c;
}
int main(){
for(int i=1;i<100;i++){
cin>>a[i];
insert(i,i,a[i]);
}
int l,r,c;//让a数组的l和r段每一个数加上c;
insert(l,r,c);
//更新b的前缀和数组a;
for(int i=1;i<100;i++)
a[i]=a[i-1]+b[i];
for(int i=0;i<100;i++)
cout<<a[i]<<"";
return 0;
}
//二维
void insert(int x1, int y1, int x2, int y2, int c) {
b[x1][y1] += c;
b[x2 + 1][y1] -= c;
b[x1][y2 + 1] -= c;
b[x2 + 1][y2 + 1] += c;
}
int main() {
cin >> n >> m >> q;
//读入并构建
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++)
cin >> a[i][j], insert(i, j, i, j, a[i][j]);//得到b[][];
//q次区域变化
int x1, y1, x2, y2, c;
cin >> x1 >> y1 >> x2 >> y2 >> c;
insert(x1, y1, x2, y2, c);
//还原二维数组
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {//二维前缀和公式
a[i][j] = a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1] + b[i][j];//更新a数组;
printf("%d ", a[i][j]);
}
printf("\n");
}
return 0;
}