-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question 84 #197
Comments
HEY!!! I want to work on this issue |
Nikita Miraje |
Hi! @JMukta25 Can you please assign me this task. |
How many issues have been assigned to you yet? |
Only 1 |
I have assigned this issue. |
A jail has a number of prisoners and a number of treats to pass out to them. Their jailer decides the fairest way to divide the treats is to seat the prisoners around a circular table in sequentially numbered chairs. A chair number will be drawn from a hat. Beginning with the prisoner in that chair, one candy will be handed to each prisoner sequentially around the table until all have been distributed.
The jailer is playing a little joke, though. The last piece of candy looks like all the others, but it tastes awful. Determine the chair number occupied by the prisoner who will receive that candy.
n=4
m=6
s=2
There are 4 prisoners, 6 pieces of candy and distribution starts at chair 2 . The prisoners arrange themselves in seats numbered 1 to 4 . Prisoners receive candy at positions 2,3,4,1,2,3 . The prisoner to be warned sits in chair number .
Input Format
int n: the number of prisoners
int m: the number of sweets
int s: the chair number to begin passing out sweets from
Input 1
2
5 2 1
5 2 2
Output
2
3
Input 2
2
7 19 2
Output
6
3
3 7 3
The text was updated successfully, but these errors were encountered: