The Remaining Cake
Submissions: 832   Accuracy:


  Difficulty: Basic   Marks: 1

Given a circular cake of radius R, divide the cake amongst N number of people such that every person gets 1/Mth portion of the cake, where N and M are positive non-zero integers and M>=N. Find the arc length of the piece of cake that is left over after the distribution.

First line of input is an integer T, denoting the number of test cases. For each test case, input three values separated by a space on a single line, R, N and M, denoting radius of cake, number of people and fraction of share to be given to each person respectively. R is a floating point number with a precision of 2. For each test case, M is always greater than or equal to N.

Output of each test case gives a floating point number upto a precision of 2 digits, denoting the arc length of the remaining cake.

0.00 <= R < 10.00
1 <= N <= 20
1 <= M <= 30

PI = 3.14

7.50 4 7
6.66 3 4
3.80 4 5
8.00 5 5


In the first test case, 4 people must be given 1/7th share of the circular cake. Hence 4/7th portion of the cake is taken away. The remaining 3/7th portion's arc length is calculated to be 20.19 units.
Similarly, for the rest three test cases, the arc length of the remaining portion is calculated using the necessary arithmetic and mathematical operations.

** For More Input/Output Examples Use 'Expected Output' option **

Author: Anushree_20

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use, generate link and share the link here.

to report an issue on this page.