大佬帮忙看一下

P1319 压缩技术

jiangjunhao @ 2023-11-22 20:15:13

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, a[101], num = 0;
    cin>>n;
    for(int i = 1;i <= n;i++){
        cin>>a[i];
    }
    for(int i = 1;i <= n;i++){
        for(int j = 1;j <= a[i];j++){
            if(i % 2 == 1 && num < n){
                cout <<0;
                num++;
            } else if(num < n) {
                cout<<1;
                num++;
            }
            else {
                cout<<endl;
                num = 0;
            }
        }
    }
    return 0;
}

by zyx3838 @ 2023-12-02 09:37:53

@jiangjunhao 你去好好看一下题目的输入


by zyx3838 @ 2023-12-02 09:38:31

是若干个数,并不是n个数


by zyx3838 @ 2023-12-02 09:38:52

是n*n的大小


|