|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||11||6||6||54.545%|
You have an m-by-n grid of squares that you wish to color. You may color each square either red or blue, subject to the following constraints:
Given these constraints, how many distinct colorings of the grid are there? The grid cannot be rotated.
The first line of input consists of two space-separated integers m and n (1 ≤ m, n ≤ 30).
Each of the next m lines contains n characters, representing the grid. Character ‘B’ indicates squares that are already colored blue. Similarly, ‘R’ indicates red squares. Character ‘.’ indicates squares that are not colored yet.
Print, on a single line, the number of distinct colorings possible.
3 2 .. B. .R
7 6 ...... .....B .B..R. ...... ...B.. .R.... ...R..
2 2 R. .B
For the first sample, the 6 ways are:
BB BB BR BR BB BB BB BR BR BR BR BB BR BR BR RR RR RR