文件名称:1
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:96.81kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
一条贪吃的蛇在一个n*m的网格中游走,它只能从一个方格走向另一个相邻的方格,这里相邻的意思是两个方格有公共边。每个方格可以看作是一个房间,其中一些是空的,一些存放有苹果。贪吃的蛇根本不进入空的房间,而进入有苹果的房间后就可以带走所有苹果使房间成为空的。蛇从一个指定的房间出发,最终回到它的家,把一路带来的苹果存储到家中,当然,它希望带来的苹果最多。请编写程序,输入有整数n和m,及n*m的一个矩阵,矩阵元素数值中有一个是 -1,表示蛇的出发位置,有一个是 -2,表示蛇的家的位置,其余数值是非负整数,0表示房间为空,非零整数表示苹果的数目。输出蛇选择的游走路径和获得的最多的苹果数目。-A greedy snake in an n* m grid walk, it is only from one box to another box adjacent to the meaning here adjacent to the two squares have a common edge. Each square can be seen as a room, some of which are empty, some of the stored apples. Gluttonous snake did not enter an empty room, and enter the room with Apple can be taken away after all Apple to make the room become empty. Snake starting from a designated room, and eventually return to its home, the Apple store all the way to bring home, of course, it hopes to bring the apple up to. Write the program, enter the integers n and m and n* m of a matrix, the matrix element value is a-1, said the snake to the starting position, there is a 2, said the location of the snake' s home, and the remaining value non-negative integer, and 0 indicates that the room is empty, a non-zero integer number of Apple. Output snake choose to walk the path and get the maximum number of Apple.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Debug/贪吃的蛇.exe
removejunk.bat
贪吃的蛇.cpp
贪吃的蛇.dsp
贪吃的蛇.dsw
贪吃的蛇.plg
Debug
removejunk.bat
贪吃的蛇.cpp
贪吃的蛇.dsp
贪吃的蛇.dsw
贪吃的蛇.plg
Debug
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.