- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
解题报告ZOJ1361
解题报告ZOJ1361
Holedox Moving
Time Limit:?10 Seconds ?????Memory Limit:?32768 KB
During winter, the most hungry and severe time, Holedox sleeps in its lair. When spring comes, Holedox wakes up, moves to the exit of its lair, comes out, and begins its new life.
Holedox is a special snake, but its body is not very long. Its lair is like a maze and can be imagined as a rectangle with n*m squares. Each square is either a stone or a vacant place, and only vacant places allow Holedox to move in. Using ordered pair of row and column number of the lair, the square of exit located at (1,1).
Holedoxs body, whose length is L, can be represented block by block. And let B1(r1,c1) B2(r2,c2) .. BL(rL,cL) denote its L length body, where Bi is adjacent to Bi+1 in the lair for 1 i L-1, and B1 is its head, BL is its tail.
To move in the lair, Holedox chooses an adjacent vacant square of its head, which is neither a stone nor occupied by its body. Then it moves the head into the vacant square, and at the same time, each other block of its body is moved into the square occupied by the corresponding previous block.
For example, in the Figure 2, at the beginning the body of Holedox can be represented as B1(4,1) B2(4,2) B3(3,2)B4(3,1). During the next step, observing that B1(5,1) is the only square that the head can be moved into, Holedox moves its head into B1(5,1), then moves B2 into B1, B3 into B2, and B4 into B3. Thus after one step, the body of Holedox locates in B1(5,1)B2(4,1)B3(4,2) B4(3,2) (see the Figure 3).
Given the map of the lair and the original location of each block of Holedoxs body, your task is to write a program to tell the minimal number of steps that Holedox has to take to move its head to reach the square of exit (1,1).
InputThe input consists of several test cases. The first line of each case contains three integers n, m (1 n, m 20) and L (2 L 8), representing the number of rows in the lair, the number of columns in the lair and the body length of Holedox, respectivel
您可能关注的文档
最近下载
- 工商储说明书100kW_215kWh_Cabinet_User_Manual_zh.pdf VIP
- 《研学旅行产品研究国内外文献综述》1600字.docx VIP
- 石泉东路市政道路工程总体监理工作交底总体监理交底内容.doc VIP
- 初中数学八年级竞赛强化辅导讲义31讲:第 17 讲 平行四边形.docx VIP
- 足部反射区高清图,按摩足底穴位疼痛的作用,足底反射区对应病症.pdf
- 2025【基于鲶鱼效应的山西汾酒公司人力资源管理优化研究10000字】.doc VIP
- 铁路客运常识题库及答案.doc VIP
- 社会医学课件:社区卫生服务完整版.ppt VIP
- 碳化硅MOSFET半桥驱动和保护电路设计.docx VIP
- 汽车平顺性.ppt VIP
原创力文档


文档评论(0)