当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5838:Mountain

题目描述
Zhu found a map which is a $N * M$ rectangular grid.Each cell has a height and there are no two cells which have the same height. But this map is too old to get the clear information,so Zhu only knows cells which are valleys.

A cell is called valley only if its height is less than the heights of all its adjacent cells.If two cells share a side or a corner they are called adjacent.And one cell will have eight adjacent cells at most.

Now give you $N$ strings,and each string will contain $M$ characters.Each character will be '.' or uppercase 'X'.The j-th character of the i-th string is 'X' if the j-th cell of the i-th row in the mountain map is a valley, and '.' otherwise.Zhu wants you to calculate the number of distinct mountain maps that match these strings.

To make this problem easier,Zhu defines that the heights are integers between $1$ and $N*M$.Please output the result modulo $772002$.
输入解释
The input consists of multiple test cases.

Each test case begins with a line containing two non-negative integers $N$ and $M$. Then $N$ lines follow, each contains a string which contains $M$ characters. $(1 \leq N \leq 5,1 \leq M \leq 5)$.
输出解释
For each test case, output a single line "Case #x: y", where x is the case number, starting from 1. And y is the answer after module 772002.
输入样例
2 4
.X..
...X
4 2
X.
..
..
X.
1 2
XX
输出样例
Case #1: 2100
Case #2: 2520
Case #3: 0
来自杭电HDUOJ的附加信息
Author UESTC
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5838

最后修改于 2020-10-25T23:26:04+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000/1500MS(Java/Others) 65536/65536K(Java/Others)