文件名称:Josephus
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:880byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
编写程序,模拟约瑟夫环(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
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.