Help Me With C Programming. At Lili's birthday party, there is a game arranged by Jojo as the host. The game is handing out a number of Y candies to a number of X people where all the sweets taste sweet except for the last one candy that tastes like rotten beans. The distribution of sweets will be sequential starting from position Z and if it passes the last position then the distribution of candy continues to the first position. Write down the person in the position of who will get the last candy. Format Input The first line of input is T, which is the number of test cases. The second row and the next number of T lines are X, Y, Z. X is the number of people who will be handed out candy. Y is the number of candies available. Z is the initial position of the person who will be handed out the candy. Format Output A string of "Case #N: " and a number that is the position of the person who got the last candy [Look at Image] In the sample above, for example, which is inputted in the case: - 3 4 1 means there are 3 people who will be distributed candy, there are 4 candies, starting divided from person to 1. So that the 1st, 2nd, 3rd person will each get one candy and then return to the 1st person getting the last candy. Output 1. - 4 2 2 means there are 4 people who will be distributed candy, there are 2 candies, starting divided from person to 2. So that the 2nd person, 3 will each get 1 candy where the last candy is obtained by the 3rd person. - 4 5 2 means that the order of distribution of sweets is from person to 2, 3, - 4, 1, 2. The last person to get candy is the 2nd person, then output 2.
Help Me With C Programming.
At Lili's birthday party, there is a game arranged by Jojo as the host. The game is handing out a number of Y candies to a number of X people where all the sweets taste sweet except for the last one candy that tastes like rotten beans. The distribution of sweets will be sequential starting from position Z and if it passes the last position then the distribution of candy continues to the first position. Write down the person in the position of who will get the last candy.
Format Input
The first line of input is T, which is the number of test cases.
The second row and the next number of T lines are X, Y, Z.
X is the number of people who will be handed out candy.
Y is the number of candies available.
Z is the initial position of the person who will be handed out the candy.
Format Output
A string of "Case #N: " and a number that is the position of the person who got the last candy
[Look at Image]
In the sample above, for example, which is inputted in the case:
- 3 4 1 means there are 3 people who will be distributed candy, there are 4 candies, starting divided from person to 1. So that the 1st, 2nd, 3rd person will each get one candy and then return to the 1st person getting the last candy. Output 1.
- 4 2 2 means there are 4 people who will be distributed candy, there are 2 candies, starting divided from person to 2. So that the 2nd person, 3 will each get 1 candy where the last candy is obtained by the 3rd person.
- 4 5 2 means that the order of distribution of sweets is from person to 2, 3, - 4, 1, 2. The last person to get candy is the 2nd person, then output 2.
Step by step
Solved in 2 steps with 1 images