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

建议使用的浏览器:

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

5402:Travelling Salesman Problem

Special Judge 特殊评判
题目描述
Teacher Mai is in a maze with $n$ rows and $m$ columns. There is a non-negative number in each cell. Teacher Mai wants to walk from the top left corner $(1,1)$ to the bottom right corner $(n,m)$. He can choose one direction and walk to this adjacent cell. However, he can't go out of the maze, and he can't visit a cell more than once.

Teacher Mai wants to maximize the sum of numbers in his path. And you need to print this path.
输入解释
There are multiple test cases.

For each test case, the first line contains two numbers $n,m(1\leq n,m\leq 100,n*m\geq 2)$.

In following $n$ lines, each line contains $m$ numbers. The $j$-th number in the $i$-th line means the number in the cell $(i,j)$. Every number in the cell is not more than $10^4$.
输出解释
For each test case, in the first line, you should print the maximum sum.

In the next line you should print a string consisting of "L","R","U" and "D", which represents the path you find. If you are in the cell $(x,y)$, "L" means you walk to cell $(x,y-1)$, "R" means you walk to cell $(x,y+1)$, "U" means you walk to cell $(x-1,y)$, "D" means you walk to cell $(x+1,y)$.
输入样例
3 3
2 3 3
3 3 3
3 3 2
输出样例
25
RRDLLDRR
来自杭电HDUOJ的附加信息
Author xudyh
Recommend wange2014

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

源链接: HDU-5402

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

共提交 0

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