码迷,mamicode.com
首页 > 其他好文 > 详细

POJ 3434 Terrarium:题目解答源码

时间:2016-09-26 21:57:16      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:c++语言

      POJ 3434 Terrarium:题目解答源码

      A zoology research lab has a terrarium with rare species of snakes.Terrarium is a flat box filled with soil,and has a glass top allowing to watch the snakes.There are trenches in the soil,and snakes constantly move along the trenches.All snakes have diameter of 1 cm and integer length of no less than 2 cm.

      While watching the snakes,the zoologists discovered a pattern in their movement:each snake moves at a speed of 1 cm per second forward,until it encounters either a wall or another snake.Faced an obstacle,snake first tries to turn right,if there is also obstacle on the right,then it tries to turn left.If there is obstacle on the left also,the snake waits for a second before trying to move again.

      程序源码

      源代码如下:

技术分享

      点击了解完整源代码!


POJ 3434 Terrarium:题目解答源码

标签:c++语言

原文地址:http://12066366.blog.51cto.com/12056366/1856692

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!