Down Went The Titanic

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=25&page=show_problem&problem=2375 [PDF](https://uva.onlinejudge.org/external/113/p11380.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11380/4930d00c5f8453d85085cdda1487017730379d18.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11380/07c4390dc8f2e9bcbea6325bd6ae65250eeed71f.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11380/35f9872c9008d2acab027d3f4b06dfea896fc1d0.png)

输入输出样例

输入样例 #1

3 4 2
*~~#
...@
.~.*
3 5 1
~~*~~
#.@.#
~~*~~
1 4 2
**#~

输出样例 #1

2
2
1