#C4091. Zigzag Pattern Generation
Zigzag Pattern Generation
Zigzag Pattern Generation
In this problem, you are required to generate a zigzag pattern composed of two characters: 'X' and 'O'. Given two integers (n) and (m), representing the number of rows and columns respectively, the pattern is defined such that each cell at row (i) and column (j) (0-indexed) is filled according to the rule: if ((i + j) \mod 2 = 0) then the cell contains 'X', otherwise it contains 'O'.
For example, when (n=3) and (m=4), the resulting pattern is:
XOXO OXOX XOXO
For multiple test cases, the first line of the input contains a single integer \(T\) indicating the number of test cases. Each of the following \(T\) lines contains two space-separated integers representing \(n\) and \(m\) for that test case. The output for each test case should be printed as described, with consecutive test cases separated by a blank line.
inputFormat
The input begins with an integer (T) ((1 \leq T \leq 100)) representing the number of test cases. Each of the next (T) lines contains two integers (n) and (m) ((1 \leq n, m \leq 100)) separated by a space, where (n) is the number of rows and (m) is the number of columns for the pattern.
outputFormat
For each test case, output the zigzag pattern with (n) rows and (m) columns. Each row should be printed on a new line, and different test cases should be separated by one blank line.## sample
1
1 1
X