编译哪里出了错?

P3397 地毯

chenxinhao0402 @ 2023-02-02 10:51:50

#include<cstdio>
#include<cstring>
#define MAXN 55 
using namespace std;
int main() 
{
    int n, m, a[MAXN][MAXN];
    memset(a,0,sizeof(a));
    scanf("%d%d",&n,&m); 
    for(int i=1;i<=m;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%d",a[i][j],(j==n?'\n':''));
    return 0;
}

by Sprague_Garundy @ 2023-02-02 10:54:18

@chenxinhao0402

  1. for(int j=1;j<=n,j++)
  2. 输出第二个格式符应该是 %c。。

by zhangjiahe__ @ 2023-06-19 21:40:55

y_1 换成 "Y_1",好像math库里有一个量叫 y_1


|