c
代码说明:
说明: 约瑟夫问题的实现:设有n个人围坐在圆桌周围,现从某个位置m(1≤m≤n)上的人开始报数,报数到k的人就站出来。下一个人,即原来的第k+1个位置上的人,又从1开始报数,再报数到k的人站出来。依此重复下去,直到全部的人都站出来为止。试设计一个程序求出出列序列。(Joseph realized the problem: There are n people sitting around the round table, is from a position of m (1 ≤ m ≤ n) reported on the number of people began to be reported to the k number of people to come forward. The next person, that is, the original positions on the first k+1 people, and from the number reported at 1, then the number reported to the k to stand up. So repeat this until all the others can stand up. Try to design a program derived from the column sequence.)
下载说明:请别用迅雷下载,失败请重下,重下不扣分!