文件名称:yuesefu
介绍说明--下载内容来自于网络,使用问题请自行百度
双向约瑟夫问题(顺时针再逆时针)
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
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.