sswds8888 @ 2024-09-22 20:16:00
#include<iostream>
using namespace std;
int t[1000][1000];
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)
++t[i][j];
}
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= n; ++j)
cout << t[i][j] << " ";
cout << endl;
}
}
by scratch_szc @ 2024-09-22 20:19:03
@sswds8888 t[1000]下标为0-999,应该开大一点
by sswds8888 @ 2024-09-22 20:19:56
收到,谢谢
by 0_________0 @ 2024-09-22 20:20:11
建议开1005/1010
by scratch_szc @ 2024-09-22 20:20:27
@sswds8888 如int t[1010][1010]