#1631. 珅泽教育CSP-J第一轮模拟考第五套 第 25 题

珅泽教育CSP-J第一轮模拟考第五套 第 25 题

第2题

bool c[max_size][max_size] = {false};
void draw(int size, int x, int y)
{
    if (size == 1)
    {
        c[x][y] = true;
    }
    else
    {
        int half = size / 2;
        draw(half, x + half, y);
        draw(half, x, y + half);
        draw(half, x + half, y + half);
    }
}
void print(int n)
{
    int length = 1 << n;
    draw(length, 0, 0);
    for (int x = 0; x < length; ++x)
    {
        for (int y = 0; y < length; ++y)
        {
            if (c[x][y])
                std::cout << '*';
            else
                std::cout << '.';
        }
        std::cout << "\n";
    }
}

执行 print(n) 后,哪个位置一定不是星号( )。

{{ select(1) }}

  • (0,0)
  • (length-1, 0)
  • (0, length-1)
  • (length-1, length-1)