1 solutions

  • 0
    @ 2024-4-1 12:10:02

    #include

    using namespace std;

    int a[205][205]; int n; int x,y,k; int t = 0;

    int main(){ cin >> n; x = 1, y = 1; while (x<=n&&y<=n){ cin >> k; //当前有连续的k个数字t while (k--){ a[x][y] = t; y++; if (y>n) { x++, y = 1; } } t = 1-t; //t原来是0就变成1 原来是1就变成0 } for (int i=1;i<=n;i++){ for (int j=1;j<=n;j++) printf("%d",a[i][j]); printf("\n"); } }

    • 1

    Information

    ID
    316
    Time
    1000ms
    Memory
    125MiB
    Difficulty
    1
    Tags
    # Submissions
    55
    Accepted
    39
    Uploaded By