文件名称:JosephProblem-C
介绍说明--下载内容均来自于网络,请自行研究使用
用C语言解决约瑟夫环问题,约瑟夫环问题描述:设编号为1,2,…,n(n>0)个人按顺时针方向围坐一圈,每人持有一个正整数密码(可用随机数产生)。开始时任意给出一个报数上限值m,从第一个人开始顺时针方向自1起顺序报数,报到m时停止报数,报m的人出列,将他的密码作为新的m值,从他在顺时针方向上的下一个人起重新自1起顺序报数,报到新m值的人出列;如此下去,直到所有人全部出列为止。要求设计一个程序模拟此过程,并给出出列人的编号序列。 -Using C language to solve the issue of Joseph Ring, Joseph Ring Problem Descr iption: Let numbered 1,2, ..., n (n> 0) individuals according to a clockwise direction around a circle, one person holding a positive integer password (available random number generated). The beginning of any given number of a reported upper limit of m, from the beginning of the first person clockwise order starting from 1 is reported the number of stops reported back m the number of people who reported that m out of his password as a new value m , from his in a clockwise direction on the next person since 1 have been re-reported the number of the order, appearance, the new m value of the listed persons it goes on like this until all the column until all. Asked to design a simulation of this process, procedures, and gives the number of people out of sequence.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Joseph Problem-C.c