Computer Science, asked by ashaharshitha9, 1 year ago

There is an office party to celebrate the last quarter's performance with cake for everyone! Many different circular cakes are ordered.
Given the radii of the circular cakes and the number of guests, determine the largest piece that can be cut from the cakes such that every guest gets a piece with the same area. It is not possible that a single piece has some part of one cake and some part of another cake. To be fair, every guest is served only one piece of cake.

Answers

Answered by Anonymous
0

Answer:

According to the the problem the radius is given therefore the code is given below:

To solve this problem we will use a formula :

f(n) = n + n-1 + n-2 + ...... + 1 + f(0)

The below code is written in JAVA

class CakeCutting {  

     static int MaxSizeCakes(int p)  

   {  

       return 1 + p * (p + 1) / 2;  

// formula to find the maximum size of cakes

   }  

     

   public static void main(String arg[])  

   {  

         

System.out.print(MaxSizeCakes(3));  

   }  

}

Similar questions