C语言,dl们可以看一下是哪里错了吗?

P1319 压缩技术

Langrange2021 @ 2022-09-11 15:15:24

#include <stdio.h>
int main()
{
    int N;
    scanf("%d", &N);
    int map[201][201];
    int number;
    int count = 0;
    int co = 0;
    int x = 1, y = 1;
    while (scanf("%d", &number) != EOF)
    {
        count++;
        if (count % 2 == 1)
        {
            for (int i = 1; i <= number; i++)
            {
                co++;
                if (co % N != 1)
                {
                    map[x][y] = 0;
                    y++;
                }
                else
                {
                    y = 1;
                    x++;
                    map[x][y] = 0;
                }
            }
        }
        else if (count % 2 == 0)
        {
            for (int i = 1; i <= number; i++)
            {
                co++;
                if (co % N != 1)
                {
                    map[x][y] = 1;
                    y++;
                }
                else
                {
                    y = 1;
                    x++;
                    map[x][y] = 1;
                }
           }
        }
    }
    for (int kx = 1; kx <= N; kx++)
    {
        for (int ky = 1; ky <= N; ky++)
        {
            printf("%d", map[kx][ky]);
        }
        printf("\n");
    }
    return 0;
}

|