#C4179. Josephus Problem
Josephus Problem
Josephus Problem
The Josephus problem is a classic theoretical puzzle that involves a group of people standing in a circle. From this circle, every kth person is eliminated until only one person remains. Given the total number of persons n and an elimination step k, your task is to determine the position of the last person standing.
The solution must read input from stdin and write the output to stdout. Use the provided testing format to ensure that your solution covers various cases including small, larger, and edge cases.
inputFormat
The input consists of two space-separated integers: n (the total number of persons) and k (the step count such that every kth person is eliminated).
outputFormat
Output a single integer which is the position of the last person remaining.## sample
1 1
1