文件名称:A0_001
介绍说明--下载内容均来自于网络,请自行研究使用
N只猴子要选大王,所有猴子按1,2,3...M报数,凡报到M的退出圈外,如此循环,直到圈内只剩一只,就是大王了.
分析:建立一个环形链表,每个猴子就是链表中的一个结点,那么猴子出圈就是对环形链表中的结点的删除,只到最后剩下的一个结点为止.-N monkeys to elect king, all the monkeys reported by a number 1,2,3 ... M, where M to report the withdrawal of outsiders, and so on, until only one circle is the king of. Analysis: the establishment of a ring linked list, each monkey is a list of a node, then the monkey out of the circle is a right circular list node removal, only to the last remaining until a node.
分析:建立一个环形链表,每个猴子就是链表中的一个结点,那么猴子出圈就是对环形链表中的结点的删除,只到最后剩下的一个结点为止.-N monkeys to elect king, all the monkeys reported by a number 1,2,3 ... M, where M to report the withdrawal of outsiders, and so on, until only one circle is the king of. Analysis: the establishment of a ring linked list, each monkey is a list of a node, then the monkey out of the circle is a right circular list node removal, only to the last remaining until a node.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
A0_001.PAS