这个p容易误解
2026-04-22 20:10:10
发布于:广东
7阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
int arr[1001][1001];
for(int i=1;i<=n;i++){
for (int j=1;j<=m;j++){
cin>>arr[i][j];
}
}
int p,q;
cin >> p>>q;
int x,y,c,d;
while(p--){ //接下来的p行,每行输入四个数去修改值,但最终只输出1次
cin>>x>>y>>c>>d;
for (int i = 1;i<=n;i++){
for(int j = 1;j<=m;j++){
if(i>=x&&i<=c&&j>=y&&j<=d)arr[i][j]+=q;
}
}
}
for (int i = 1;i<=n;i++){
for(int j = 1;j<=m;j++){
cout << arr[i][j] << " ";
}
cout << endl;
}
return 0;
}
这里空空如也



有帮助,赞一个