QOJ.ac

QOJ

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

#22323. 母牛旅行

Statistics

母牛为寻找最好的草,在 $N$ 行 $M$ 列的牧场网格里旅行,$(2 \le N \le 100; 2 \le M \le 100)$。细心的 Farmer John 记录 Bessie 某时刻在 $(R1, C1)$,恰好 $T$ 秒后在 $(R2, C2)$,$(0 \lt T \le 15)$。他不知她是否在 $T$ 秒前已经过 $(R2, C2)$,但知道时刻 $T$ 她在那里。

FJ 想算整数 $S$,即从 $(R1, C1)$ 恰好 $T$ 秒到 $(R2, C2)$ 的走法数。每秒必须走到上下左右相邻位置,不能休息。牧场的树不能通过。

地图 . 表示空地、* 表示树,求从 $(R1, C1)$ 在 $T$ 秒到 $(R2, C2)$ 的可能走法数。

输入格式

  • 第 1 行:三个空格分隔整数 $N$、$M$、$T$。
  • 第 $2,\ldots,N+1$ 行:第 $i+1$ 行描述第 $i$ 行,恰好 $M$ 个字符,均为 . 或 *。
  • 第 $N+2$ 行:四个空格分隔整数 $R1$、$C1$、$R2$、$C2$。

输出格式

  • 第 1 行:单独一行的整数 $S$。

样例

输入格式 1

4 5 6
...*.
...*.
.....
.....
1 3 1 5

输出格式 1

1

说明

牧场 4 行 5 列,牛从第 1 行第 3 列到第 1 行第 5 列,恰好用 6 秒。

从 $(1,3)$ 恰好 6 秒到 $(1,5)$ 只有一种走法,即明显绕过两棵树的路径。

题目作者:Aram Shatakhtsyan,2007

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.