No.82 Checkered Pattern
タグ : / 解いたユーザー数 746
作問者 :
nmnmnmnmnmnmnm
Problem Statement
Given the width W, the height H, and the color of the top-left cell, draw a checkered pattern.
A checkered pattern is a pattern in which black and white appear alternately.
The pattern shall be drawn using 'B' for black and 'W' for white.
See the samples for details.
Input
W H C
Three pieces of information are given: the width W, the height H, and the color C of the top-left cell.
W and H are integers between 1 and 50, inclusive. (1<=W,H<=50)
C is either 'B' or 'W'.
Output
Draw the checkered pattern. Do not forget a newline at the end of the last line as well.
Sample
Sample 1
Input
4 3 B
Output
BWBW WBWB BWBW
A checkered pattern with black 'B' at the top left, width 4, and height 3 has been drawn.
Sample 2
Input
3 4 W
Output
WBW BWB WBW BWB
A checkered pattern with white 'W' at the top left, width 3, and height 4 has been drawn.
Sample 3
Input
1 1 W
Output
W
Visually this does not look like a checkered pattern, but it is considered a correct answer.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。