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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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.

Constraints
1<T< 100
1< X,Y < 103
1<Z< X
Sample Input
Sample Output
Case #1: 1
Case #2: 3
Case #3: 3
4
3 4 1
352
4 2 2
45 2
Case #4: 2
Sample Input
Sample Output
Case #1:6
Case #2: 3
2
7 19 2
3 7 3
Transcribed Image Text:Constraints 1<T< 100 1< X,Y < 103 1<Z< X Sample Input Sample Output Case #1: 1 Case #2: 3 Case #3: 3 4 3 4 1 352 4 2 2 45 2 Case #4: 2 Sample Input Sample Output Case #1:6 Case #2: 3 2 7 19 2 3 7 3
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY