zzgj1235 @ 2024-09-24 21:24:40
0分!
#include<bits/stdc++.h>
using namespace std;
int a[1005][1005];
int main(){
memset(a,0,sizeof(a));
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++){
int x1,y1,x2,y2;
scanf("%d%d%d%d",x1,y1,x2,y2);
for(int j=x1;j<=x2;j++){
for(int k=y1;k<=y2;k++){
a[j][k]++;
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
printf("%d ",a[i][j]);
}
printf("\n");
}
return 0;
}
by Segment_Treap @ 2024-09-24 21:35:27
有
by Segment_Treap @ 2024-09-24 21:36:09
但是你写的是 for(int i=1;i<=n;i++){
by Segment_Treap @ 2024-09-24 21:36:24
@zzgj1235
by zzgj1235 @ 2024-09-24 21:36:25
@Li_Hulian ......
by zzgj1235 @ 2024-09-24 21:36:48
WSSB
by zzgj1235 @ 2024-09-24 21:38:35
@Li_Hulian @潘德理2010 @zh_felix 感谢已AC,已关
by ss2315zjx @ 2024-11-03 10:03:04
#include<bits/stdc++.h>
using namespace std;
int a[105][105];
int main(){
int n,m,x1,x2,y1,y2;
cin>>n>>m;
for(int k=1;k<=m;k++){
cin>>x1>>y1>>x2>>y2;
for(int i=x1;i<=x2;i++){
for(int j=y1;j<=y2;j++){
a[i][j]++;
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++) cout<<a[i][j]<<" ";
cout<<'\n';
}
return 0;
}
y1可以