EMBEDDED CHESSBOARDS

Subscribers:
4,890
Published on ● Video Link: https://www.youtube.com/watch?v=MoiBEvQFsgM



Duration: 6:01
40 views
0


How many chessboards can be found in the painting? I was wondering.

EXPLANATION CODE:
1) This code reads a sequence of Painting objects from standard input, which contain the row, column, and color (either 0 or 1, representing black and white, respectively) of a square in a checkerboard. For each Painting, the code outputs the number of rectangles of size 8x8 that can be created on the checkerboard, using the top-left square of the rectangle as the square indicated by the Painting object, while ensuring that the top-left square is not a white square (if it were, the rectangle would not be aligned with the checkerboard's grid).
2) The code defines a Painting struct with three fields: row (an integer indicating the row of the square), col (an integer indicating the column of the square), and isWhite (an integer indicating whether the square is white, with 0 indicating black and 1 indicating white).
3) The main function begins by ignoring any input up to the end of the current line. It then enters a loop that reads Painting objects from std::cin until there is no more input, and for each object, it outputs the number of 8x8 rectangles that can be created on the checkerboard with the top-left square being the square indicated by the Painting object, as described above. The output is separated by newline characters.
#codingame #coding #game #programming #easy #difficulty #reading #arithmetic #cplusplus #cplusplusprogramming #learntocode #tutorial #education #problemsolving #algorithmic #asmr #asmrtyping #embedded #chessboard







Tags:
codingame
coding
game
programming
problem solving
problem
solving
algorithmic
reading
asmr
asmr typing
education
easy difficulty
easy
difficulty
tutorial
how to program
embedded chessboards
embedded
chessboards
c plus plus
c plus plus programming