All submissions for this problem are available.
We, the team members of Conscientia regard ourselves as very intelligent and hardworking people. So when the time came to distribute the responsibility for the food stalls we all knew that the one responsible would gain maximum benefits. That started a fight. Now being very intelligent I proposed that we come to a conclusion based on some random procedure. So I proposed that we all should stand sequentially and remove every kth person from the line until only one is left. Everyone thought this to be a really good idea as only I, being the only one from CS background knew that this is not at all random. Now that I have been chosen, you have to basically prove to the team that I made a fool of them.
The first line contains the number of test cases, t.
For each test case, a single line contains a single number n denoting the number of people in the team.
For each test case the position where I stood to get the responsibility for the food stalls in a seperate line.
Sample Input: 2 10 3 20 5 Sample Output: 4 7
|Time Limit:||0.1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CLOJ, COB, CPP 4.3.2, CPP14, FS, GO, kotlin, NODEJS, PERL6, PYPY, PYTH 3.5, rust, SCM chicken, swift, TEXT|
Fetching successful submissions
If you are still having problems, see a sample solution here.