##全Wonderful Answer,蒟蒻求助

P1319 压缩技术

Zongmingjun @ 2021-10-29 20:57:15

神犇们帮忙看看吧,这是代码

#include<bits/stdc++.h>
#define ll long long
using  namespace std;
int a[260],x[210][210];
void End(){
    #define Fuck return 
    #define CCF 0
}
int main(){
    int n=0;
    while(cin>>a[n]) n++;
    n++;
    int hang=1,lie=1;
    for(int i=1;i<=n;i++){
        while(lie<=a[0]){
            if(i%2==1){
                x[hang][lie]=0;
                lie++;
            }
            else{
                x[hang][lie]=1;
                lie++;
            }
        }
        if(lie>a[0]){
            lie=1,hang++;
        }
    }
    for(int i=1;i<=hang;i++){
        for(int j=1;j<=a[0];j++){
            printf("%d",x[i][j]);
        }
        printf("\n");
    }
    End();
    Fuck CCF;
}

by FanSizhe127 @ 2021-12-06 16:46:07

#include<bits/stdc++.h>
using namespace std;
//7 3 1 6 1 6 4 3 1 6 1 6 1 3 7
int main()
{
    long long n,a[10005],i,j,k=1,l,flag=0;
    cin>>n;
    for(i=1;i<=n*2;i++)
        cin>>a[i];
    for(i=1;i<=n*2;i++)
    {
        for(j=1;j<=a[i];j++)
        {
            cout<<flag;
            if(k%n==0)
                cout<<'\n';
            k++;
        }
        flag=!flag;
    }
}

by Zongmingjun @ 2021-12-26 10:00:33

@FanSizhe127 Thanks


|