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.