文件名称:yuesefu
- 所属分类:
- 控制台(字符窗口)编程
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2015-11-26
- 文件大小:
- 1kb
- 下载次数:
- 0次
- 提 供 者:
- your****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
双向约瑟夫问题(顺时针再逆时针)
n个人排成一个圆圈,从第一个人开始,先按顺时针方向,数m,数到m的人退出圆圈,然后从原有方向的下一个人开始,按原来顺序的反方向继续数m,依次数数,直到只剩最后一个人为止。比如有5个人,数3,则依次出去的人为3,1,4,5,2,最后的人是2号。现已知n和m,请问最后一个人的编号是多少?-Joseph problems bidirectional (clockwise then counterclockwise) n individual arranged in a circle, starting the first person, press the clockwise direction, the number of m, the number of people who quit circle to m, then the next person the original direction beginning with the opposite direction of the original order continues to count m, depending on the number of times, until only the last one so far. For example, there are five individuals, number 3, then turn out artificial 3,1,4,5,2, and finally people are on the 2nd. It is known that n and m, ask the last person number?
n个人排成一个圆圈,从第一个人开始,先按顺时针方向,数m,数到m的人退出圆圈,然后从原有方向的下一个人开始,按原来顺序的反方向继续数m,依次数数,直到只剩最后一个人为止。比如有5个人,数3,则依次出去的人为3,1,4,5,2,最后的人是2号。现已知n和m,请问最后一个人的编号是多少?-Joseph problems bidirectional (clockwise then counterclockwise) n individual arranged in a circle, starting the first person, press the clockwise direction, the number of m, the number of people who quit circle to m, then the next person the original direction beginning with the opposite direction of the original order continues to count m, depending on the number of times, until only the last one so far. For example, there are five individuals, number 3, then turn out artificial 3,1,4,5,2, and finally people are on the 2nd. It is known that n and m, ask the last person number?
(系统自动生成,下载前可以参看下载内容)
下载文件列表
双向约瑟夫.cpp