压缩技术
查看原帖
压缩技术
1612787
zengzhengsen楼主2025/1/2 09:21

求助,只有60,不知道哪里有点小问题

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int he=0,k=0;
    int num[40000],a[20][20]={0};
    while(he!=n*n){
    cin>>num[k];he+=num[k];k++;}
    int h=0,l=0,shu=0;
    for(int i=0;i<k;i++){
        for(int j=0;j<num[i];j++){
            a[h][l]=shu;l++;
            if(l==n){l=0;h++;}
        }
    shu=1-shu;}
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
        cout<<a[i][j];
        }cout<<endl;
    }
    return 0;}
    
2025/1/2 09:21
加载中...