Editorial for COCI '12 Contest 3 #1 Sahovnica
Submitting an official solution before solving the problem yourself is a bannable offence.
There are multiple different approaches to this problem: we can use a matrix of characters, but we don't need to.
First method
Using two for loops, where one iterates over the total number of output rows, and the other (nested) over output columns, we output the appropriate characters. Here, we need a function to determine, given the current row and column
Notice that, if we number the rows and columns from 0 (in which case relations
Second method
We use a character matrix in which we draw chessboard cells one by one. We choose the current cell using two nested for loops and draw it, again using two nested for loops. Here we need to compute the starting coordinates of the current chessboard cell: they are
Comments