HDU 2612 Find a way(BFS)
来源:互联网 发布:java设计模式分类方法 编辑:程序博客网 时间:2024/05/16 04:50
Find a way
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Problem Description
Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.
Yifenfei’s home is at the countryside, but Merceki’s home is in the center of city. So yifenfei made arrangements with Merceki to meet at a KFC. There are many KFC in Ningbo, they want to choose one that let the total time to it be most smallest.
Now give you a Ningbo map, Both yifenfei and Merceki can move up, down ,left, right to the adjacent road by cost 11 minutes.
Yifenfei’s home is at the countryside, but Merceki’s home is in the center of city. So yifenfei made arrangements with Merceki to meet at a KFC. There are many KFC in Ningbo, they want to choose one that let the total time to it be most smallest.
Now give you a Ningbo map, Both yifenfei and Merceki can move up, down ,left, right to the adjacent road by cost 11 minutes.
Input
The input contains multiple test cases.
Each test case include, first two integers n, m. (2<=n,m<=200).
Next n lines, each line included m character.
‘Y’ express yifenfei initial position.
‘M’ express Merceki initial position.
‘#’ forbid road;
‘.’ Road.
‘@’ KCF
Each test case include, first two integers n, m. (2<=n,m<=200).
Next n lines, each line included m character.
‘Y’ express yifenfei initial position.
‘M’ express Merceki initial position.
‘#’ forbid road;
‘.’ Road.
‘@’ KCF
Output
For each test case output the minimum total time that both yifenfei and Merceki to arrival one of KFC.You may sure there is always have a KFC that can let them meet.
Sample Input
4 4Y.#@.....#..@..M4 4Y.#@.....#..@#.M5 5Y..@..#....#...@..M.#...#
Sample Output
668866
阅读全文
0 0
- hdu 2612 Find a way(BFS)
- HDU 2612 Find a way (BFS)
- HDU 2612 Find a way (bfs)
- HDU 2612 Find a way(bfs)
- HDU - 2612 - Find a way (BFS)
- HDU 2612 Find a way (BFS)
- HDU 2612 Find a way(BFS)
- hdu 2612 Find a way(BFS)
- HDU 2612 Find a way(BFS)
- HDU-2612-Find a way(BFS)
- HDU 2612 Find a way (BFS)
- 【HDU 2612】Find a way(BFS)
- HDU 2612 Find a way (BFS)
- HDU 2612 Find a way(BFS)
- hdu 2612 Find a way (BFS)
- HDU 2612 Find a way(BFS)
- HDU.2612 Find a way (BFS)
- hdu 2612Find a way (BFS~)
- Python之阿姆斯特朗数
- asp.net中四种文件下载方法
- 开发工具——日志Timber的使用
- FeatureLayer的增删改查,编辑要素以及添加shape操作
- ShellCode转换为JavaScript支持的形式代码
- HDU 2612 Find a way(BFS)
- SQL开发技巧 join从句
- python1~5
- linnux socket 缓冲区详解
- Ubuntu串口minicom连接开发板
- 在服务中使用android:process=":remote"的意义
- python3任意位数的磁力数求法
- Spring MVC之@RequestBody, @ResponseBody 详解
- 《技术之瞳》 -- 计算机组成原理 -- 习题 2.29