本地完全可以,有没有大佬救下

P1319 压缩技术

sevensky @ 2022-11-08 17:05:12

#include<stdio.h>
int main() {
    int n;
    scanf("%d", &n);
    int m[1001]={0};
    int t=n*n, sum = 0; int flag = 0;
    while (t) {
        for (int i = 0;t>0; i++) {
            int a;
            scanf("%d", &a);
            if (flag == 0) {
                for (int j = sum; j <( sum+a); j++) {
                    m[j] = 0;
                    flag = 1;
                }
            }
            else {
                for (int j = sum; j <(sum+ a); j++) {
                    m[j] = 1;
                    flag = 0;
                }

            }
            t -= a; sum += a;
        }
    }
    printf("%d", m[0]);
    for (int i = 1; i < n * n; i++) {if (i % 7 == 0)printf("\n");
        printf("%d", m[i]);

    }
    return 0;
}

by zhangzhanhao @ 2022-12-08 16:26:07

是n个换一次行不是七个


|