QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21121. 奶牛跳房子(铜组)

Statistics

就像人类喜欢跳房子,Farmer John 的奶牛也发明了自己的变体。由体重近一吨的笨拙动物玩,奶牛跳房子几乎总是以灾难告终,但令人惊讶的是,这并没阻止她们几乎每天下午都试着玩。

游戏在 $R$ 行 $C$ 列网格($2 \leq R \leq 15$,$2 \leq C \leq 15$)上进行,每格是红色或蓝色。奶牛从左上角通过一系列跳跃到达右下角。一次跳跃合法当且仅当:

  1. 跳到颜色不同的格子;
  2. 目标格子至少比当前格子低一行;并且
  3. 目标格子至少比当前格子向右一列。

请计算从左上角到右下角的不同合法跳跃序列数。

输入格式

第一行包含整数 $R$ 和 $C$。接下来 $R$ 行,每行 $C$ 个字符。每个字符是 R 或 B,分别表示红格或蓝格。

输出格式

输出从左上角跳到右下角的不同方法数。

样例

输入格式 1

4 4
RRRR
RRBR
RBBR
RRRR

输出格式 1

3

出题人:Nick Wu,2015

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.