Chess board (4)

Write code for, given a non-negative integer nn, where n=2kn=2^k for some k1k \geq 1, printing a chess board of size nn, as shown in the examples.

The program must implement and use the CHESS-BOARD function, which can be iterative or recursive and is not allowed to perform input/output operations.

Make one submission with Python code and another submission with C++ code.

Input

The input is an integer nn of the form n=2kn=2^k for some k1k \geq 1.

Output

The output is a chess board of size nn.

Observation

The size nn of a chess board is always of the form n=2kn=2^k for some k1k \geq 1.

Problem information

Author: Gabriel Valiente

Generation: 2026-01-25T16:02:14.812Z

© Jutge.org, 2006–2026.
https://jutge.org