-->
当前位置:首页 > 题库

PROGRAMMING:The problem of Josephus rings hebust

Luz5年前 (2021-05-10)题库410
Joseph Ring problem
Josephus ring is a mathematical application problem: n people (denoted by numbers a, B, C... Respectively) are known to sit around a round table. Start counting from the person whose number is 1, and count to the person whose number is m; His next person starts to count from 1, and the one who counts to m comes out again; Repeat this rule until all the people around the round table are out.
###Input format:
Fixed as 2 lines, the first line is m, the second line is n, the name list of individuals is represented by English letters, and the elements are separated by English commas
###Output format:
One line is a sequence of listed elements, separated by English commas. [Note: there is no comma after the last element]
###Input example:
Here is a set of inputs. For example:
```in
three
a,b,c,d,e,f,g
```
###Output example:
The corresponding output is given here. For example:
```out
c,f,b,g,e,a,d
```






answer:If there is no answer, please comment