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
- Find maximum number that can be formed using digits of a given number
- Represent a number as a sum of maximum possible number of Prime Numbers
- Querying maximum number of divisors that a number in a given range has
- Find the maximum number of composite summands of a number
- Number with maximum number of prime factors
- Maximum number of segments that can contain the given points
- Find the maximum number of handshakes
- Find a positive number M such that gcd(N^M, N&M) is maximum
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.