文件名称:xiaocai
介绍说明--下载内容均来自于网络,请自行研究使用
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