文件名称:Test(2)
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:1.08kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
用循环单链表实现:
N个人围圆圈而坐,分别标以数字1到N。从坐在1号的位置的人开始依次传递土豆。M次传递之后,拿到土豆的人被排除,圆圈收缩,然后从离开圆桌的人后面的那个人开始继续游戏。游戏一直进行,直到留下最后一个人,为赢家。因此,如果M=0且N=5,所有的人依次被排除,5号最后胜利。如果M=1且N=5,排除的顺序为2,4,1,5.
-Achieved with cyclic single-linked list: N individuals sitting around a circle, were marked with numbers 1 to N. No. 1 position from sitting in order, starting with the person passing the potatoes. M after the second pass, to get potatoes were excluded, the circles shrink, and then leave the round table behind the man who started to continue the game. The game has been carried out until the last person left for the winner. Therefore, if M = 0 and N = 5, all the people in turn are excluded, 5, the final victory. If M = 1 and N = 5, excluding the order 2,4,1,5.
N个人围圆圈而坐,分别标以数字1到N。从坐在1号的位置的人开始依次传递土豆。M次传递之后,拿到土豆的人被排除,圆圈收缩,然后从离开圆桌的人后面的那个人开始继续游戏。游戏一直进行,直到留下最后一个人,为赢家。因此,如果M=0且N=5,所有的人依次被排除,5号最后胜利。如果M=1且N=5,排除的顺序为2,4,1,5.
-Achieved with cyclic single-linked list: N individuals sitting around a circle, were marked with numbers 1 to N. No. 1 position from sitting in order, starting with the person passing the potatoes. M after the second pass, to get potatoes were excluded, the circles shrink, and then leave the round table behind the man who started to continue the game. The game has been carried out until the last person left for the winner. Therefore, if M = 0 and N = 5, all the people in turn are excluded, 5, the final victory. If M = 1 and N = 5, excluding the order 2,4,1,5.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Test(2).txt
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.