大佬们救救孩子求助求助

P1319 压缩技术

s_yang @ 2021-11-13 23:51:19

#include<stdio.h>
int main()
{
    int n=1, i, j, c, d, e,f,t=0;
    scanf("%d", &n);
    while(t<n*n)
        for (j = 0;j < n;j++)
        {
            scanf("%d", &c);
            for (d = 1;d <= c;d++)
            {
                printf("0");t++;
                if(t%n==0&&(t>n||t==n))
                    printf("\n");
            }
            scanf("%d", &e);
            for (f = 1;f <= e;f++)
            {
                printf("1");t++;
                if (t % n == 0 && (t > n || t == n))
                    printf("\n");
            }
        }
    return 0;
}

by s_yang @ 2021-11-13 23:51:58

样例能过,提交才10分


by ningago @ 2021-11-14 00:12:58

@2329344548zy

第七行的for循环去掉,没说压缩码有n个数字


|