文件名称:xiaocai
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:2.34kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
Joseph环
编号是1,2,……,n的n个人按照顺时针方向围坐一圈,每个人只有一个密码(正整数)。一开始任选一个正整数作为报数上限值m,从第一个仍开始顺时针方向自1开始顺序报数,报到m时停止报数。报m的人出列,将他的密码作为新的m值,从他在顺时针方向的下一个人开始重新从1报数,如此下去,直到所有人全部出列为止。设计一个程序来求出出列顺序。
设计要求:
设计一个程序,以人机交互的方式执行,用户指定约瑟夫环游戏的总人数n和初始的报数上限m,然后输入每个人所持有的密码key。模拟约瑟夫环,从头开始报数,直到所有人出列。系统按照出列顺序给出编号及该人所持有的密码。-Joseph Central No. 1, 2, ...... n n individuals sit in a circle in a clockwise direction, each person has only one password (a positive integer). Beginning optionally a positive integer as the reported number of the upper limit of m from the first still clockwise direction since the a start sequence reported number, report m stop the reported number. Reported m the man out of the line, his password as the new value of m, start from the next person in the clockwise direction from a reported number, and so on, until all the columns until all. Design a program determined the order of columns. Design requirements: to design a program that executed the way of human-computer interaction, the user specifies Josephus games n and the initial total number of reported maximum number m, and then enter each person held some password key. Analog Josephus, from the beginning to count off until all the columns. System given the order out of the line number and the person held password.
编号是1,2,……,n的n个人按照顺时针方向围坐一圈,每个人只有一个密码(正整数)。一开始任选一个正整数作为报数上限值m,从第一个仍开始顺时针方向自1开始顺序报数,报到m时停止报数。报m的人出列,将他的密码作为新的m值,从他在顺时针方向的下一个人开始重新从1报数,如此下去,直到所有人全部出列为止。设计一个程序来求出出列顺序。
设计要求:
设计一个程序,以人机交互的方式执行,用户指定约瑟夫环游戏的总人数n和初始的报数上限m,然后输入每个人所持有的密码key。模拟约瑟夫环,从头开始报数,直到所有人出列。系统按照出列顺序给出编号及该人所持有的密码。-Joseph Central No. 1, 2, ...... n n individuals sit in a circle in a clockwise direction, each person has only one password (a positive integer). Beginning optionally a positive integer as the reported number of the upper limit of m from the first still clockwise direction since the a start sequence reported number, report m stop the reported number. Reported m the man out of the line, his password as the new value of m, start from the next person in the clockwise direction from a reported number, and so on, until all the columns until all. Design a program determined the order of columns. Design requirements: to design a program that executed the way of human-computer interaction, the user specifies Josephus games n and the initial total number of reported maximum number m, and then enter each person held some password key. Analog Josephus, from the beginning to count off until all the columns. System given the order out of the line number and the person held password.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
xiaocai.cpp
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.