3 solutions

  • 1
    @ 2022-9-11 22:40:33

    关键pattern0110\Leftrightarrow1001,让0110不断重复,然后再根据nmod4n \mod 4讨论即可。

    #include<bits/stdc++.h>
    using namespace std;
    
    int main(){
    int T=1;
    while(T--){
    int n;
    cin>>n;
    if(n==2) printf("01");
    else if(n==3) printf("wasted");
    else if(n==4) printf("0110");
    else if(n==5) printf("01010");
    else if(n==6) printf("010001");
    else if(n==7) printf("0110001");
    else if(n%4==0) for(int t=1;t<=n/4;++t) printf("0110");
    else if(n%4==1) {
    printf("011000110");
    for(int t=3;t<=n/4;++t)
    printf("0110");
    }else if(n%4==2) {
    printf("10");
    for(int t=1;t<=n/4;++t)
    printf("0110");
    }else if(n%4==3){
    printf("10011000110");
    for(int t=3;t<=n/4;++t)
    printf("0110");
    }
    putchar('\n');
    }
    return 0;
    }
    

    Information

    ID
    154
    Time
    1000ms
    Memory
    512MiB
    Difficulty
    6
    Tags
    # Submissions
    153
    Accepted
    42
    Uploaded By