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

建议使用的浏览器:

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

5335:Walk Out

题目描述
In an $n*m$ maze, the right-bottom corner is the exit (position $(n,m)$ is the exit). In every position of this maze, there is either a $0$ or a $1$ written on it.

An explorer gets lost in this grid. His position now is $(1, 1)$, and he wants to go to the exit. Since to arrive at the exit is easy for him, he wants to do something more difficult. At first, he'll write down the number on position $(1, 1)$. Every time, he could make a move to one adjacent position (two positions are adjacent if and only if they share an edge). While walking, he will write down the number on the position he's on to the end of his number. When finished, he will get a binary number. Please determine the minimum value of this number in binary system.
输入解释
The first line of the input is a single integer $T\ (T=10)$, indicating the number of testcases.

For each testcase, the first line contains two integers $n$ and $m \ (1 \le n, m \le 1000)$. The $i$-th line of the next $n$ lines contains one 01 string of length $m$, which represents $i$-th row of the maze.
输出解释
For each testcase, print the answer in binary system. Please eliminate all the preceding $0$ unless the answer itself is $0$ (in this case, print $0$ instead).
输入样例
2
2 2
11
11
3 3
001
111
101
输出样例
111
101
来自杭电HDUOJ的附加信息
Author XJZX
Recommend wange2014

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

源链接: HDU-5335

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

共提交 0

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