- Category:
- Data structs
- Tags:
-
- File Size:
- 1kb
- Update:
- 2018-04-09
- Downloads:
- 0 Times
- Uploaded by:
- 爱西瓜的伊卡
Description: The Joseph question is a classic question. Known n individuals (may as well as number 1, 2, 3,..., n representative) sit around a round table, start from people numbered K, and start clockwise from 1 to 1, 2, 3,..., the time needle counts to the m person, out and out. Then from the next on the next person, from 1 to the 1 to continue clockwise, the number to the person, out and output,... Then repeat, until the round table all out of the list.
Input: n, K, M
Output: according to the order of output, the number of the listed people is numbered. The number is separated by one space, and each 10 numbers are one row.
The corresponding output of illegal input is as follows
A)
Input:: n, K, and m are less than 1
Output: n, m, K must bigger than 0.
B)
Input: k>n
Output: K should not bigger than n.
example
input
9,3,2
output
468137295
To Search:
File list (Check if you may need any files):
Filename | Size | Date |
---|
约瑟夫环.cpp | 722 | 2018-03-13
|
寻找特殊偶数.cpp | 809 | 2016-04-02
|
未命名2.cpp | 248 | 2016-03-19
|
未命名1.cpp | 360 | 2018-03-13 |