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.