Given a square piece and a total number of cuts available n, Find out the maximum number of rectangular or square pieces of equal size that can be obtained with n cuts. The allowed cuts are horizontal and vertical cut.
Note: Stacking and folding is not allowed.
Input : n = 1 Output : 2 Explanation : Input : n = 2 Output : 4 Explanation : Input : n = 3 Output : 6 Explanation :
Given is n which is the number of allowed cuts. As it is required to maximize number of pieces after n cuts, So number of horizontal cuts will be equal to number of vertical cuts. This can be prove using differentiation. So number of horizontal cut will be n/2. and vertical cuts will be n-n/2.
So number of pieces = (horizontal cut + 1) * (vertical cut + 1).
Max number of pieces for n = 3 is 6
- Count pieces of circle after N cuts
- Possible cuts of a number such that maximum parts are divisible by 3
- Minimum number of cuts required to make circle segments equal sized
- Probability of cutting a rope into three pieces such that the sides form a triangle
- Probability that the pieces of a broken stick form a n sided polygon
- Minimum Cuts can be made in the Chessboard such that it is not divided into 2 parts
- Minimum cuts required to divide the Circle into equal parts
- Represent a number as a sum of maximum possible number of Prime Numbers
- Find maximum number that can be formed using digits of a given number
- Querying maximum number of divisors that a number in a given range has
- Number with maximum number of prime factors
- Find the maximum number of handshakes
- Maximum number of ones in a N*N matrix with given constraints
- Find a positive number M such that gcd(N^M, N&M) is maximum
- Number of subarrays whose minimum and maximum are same
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.