请问此题使用什么算法

矮胖挫 2006-06-29 08:39:37
原题目网址:http://acm.pku.edu.cn/JudgeOnline/problem?id=1548
Your company provides robots that can be used to pick up litter from fields after sporting events and concerts. Before robots are assigned to a job, an aerial photograph of the field is marked with a grid. Each location in the grid that contains garbage is marked. All robots begin in the Northwest corner and end their movement in the Southeast corner. A robot can only move in two directions, either to the East or South. Upon entering a cell that contains garbage, the robot will pick it up before proceeding. Once a robot reaches its destination at the Southeast corner it cannot be repositioned or reused. Since your expenses are directly proportional to the number of robots used for a particular job, you are interested in finding the minimum number of robots that can clean a given field. For example, consider the field map shown in Figure 1 with rows and columns numbered as shown and garbage locations marked with a 'G'. In this scheme, all robots will begin in location 1,1 and end in location 6, 7.

Your task is to create a program that will determine the minimum number of robots needed to pick up all the garbage from a field.
...全文
231 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
SamuelKevin 2006-06-29
  • 打赏
  • 举报
回复
哦 不对是贪心吧 寒
SamuelKevin 2006-06-29
  • 打赏
  • 举报
回复
English不行 不过粗略看了一下原题 感觉貌似用到回溯
xyq1986 2006-06-29
  • 打赏
  • 举报
回复
这题没做过……不过20分要个算法也太少了吧……
矮胖挫 2006-06-29
  • 打赏
  • 举报
回复
感谢,说的很明白了
sharpdew 2006-06-29
  • 打赏
  • 举报
回复
类似在一个N*N的网格中划路径,对于每条路径来说要使得路径上遇到的垃圾尽量多,对于整个问题来说要使得能覆盖垃圾的所有路径最少。
路径只能从(1,1)开始到(N,N)点结束,且每走一步点的横坐标和纵坐标至少有一个加1。
这个问题可以通过把所有垃圾对应的点连接成一个图来解决,这个图中从开始点到结束点的所有路径就是所要求的机器人数目。连线的规则如果一个点的坐标均不大于另外一个点的坐标,则这两个点之间可以连一条线。
yingge 2006-06-29
  • 打赏
  • 举报
回复
ACM的题吧,应该有sample input和sample output才对啊

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧