1 条题解

  • 0
    @ 2025-10-8 16:58:07
    #include <bits/stdc++.h>
    using namespace std;
    bitset<20> B;
    int main()
    {
        int n;scanf("%d", &n);
        int N=(1<<n);
        for (int i = 0; i < N; i++)
        {
            B = (i ^ (i>>1));
            for(int j=n-1; j>= 0; j--) printf("%d",(B[j]==1));
            printf("\n");
        }
        return 0;
    }
    
    • 1

    【模拟】生成格雷码1️⃣[USACO10MAR] The Rock Game S(改)

    信息

    ID
    1634
    时间
    1000ms
    内存
    128MiB
    难度
    7
    标签
    递交数
    38
    已通过
    11
    上传者