文件名称:Josephus
介绍说明--下载内容均来自于网络,请自行研究使用
编写程序,模拟约瑟夫环(josephus)问题: n个人(编号为1,2,3,……,n (n>0) )按顺时针方向围坐一圈,每人持有一个正整数密码。开始时任意给出两个值:一个为首先报数的人的编号i (0<i<=n),另一个为起始报数上限值m。接着从编号为i的人开始按顺时针方向自1起顺序报数,报到m时停止报数,且报到m的人出列,并将他的密码作为新的m值,从他在顺时针方向上的下一个人起重新自1报数,……,如此下去,直到所有人全部出列为止。要求设计一个程序模拟此过程,给出出列人的编号序列。-Programming, simulation Josephus (Josephus): n individuals (numbered 1, 2, 3, ..., n (n> 0)) sitting around the circle clockwise, each holding a positive integer password. The beginning of any given two values: a first reported the number of people the number of i (0 <i <= n), and the other for the starting number off the upper limit of m. Then people start from the No. i in a clockwise direction from a starting sequence number off to stop the reported number of m. Report and report m, the columns, and his password as the new values of m in a clockwise since a reported number of re-starting the next person on the direction, ......, it goes on until all the total column so far. Design a program to simulate this process is given a column number of sequences.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Josephus.txt