Given the length L and breadth B of a sheet of paper, the task is to find the maximum number of rectangles with given length l and breadth b that can be cut from this sheet of paper.
Input: L = 5, B = 2, l = 14, b = 3
The sheet is smaller than the required rectangle. So, no rectangle of the given dimension can be cut from the sheet.
Input: L = 10, B = 7, l = 4, b = 3
- Try to cut the rectangles horizontally i.e. length of the rectangle is aligned with the length of the sheet and breadth of the rectangle is aligned with the breadth of the sheet and store the count of rectangles possible in horizontal.
- Repeat the same with vertical alignment i.e. when length of the rectangle is aligned with the breadth of the sheet and breadth of the rectangle is aligned with the length of the sheet and store the result in vertical. Print max(horizontal, vertical) as the result.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Paper Cut into Minimum Number of Squares
- Maximum of smallest possible area that can get with exactly k cut of given rectangular
- Divide Matrix into K groups of adjacent cells having minimum difference between maximum and minimum sized groups
- Find the number of rectangles of size 2*1 which can be placed inside a rectangle of size n*m
- Check if N rectangles of equal area can be formed from (4 * N) integers
- Count of smaller rectangles that can be placed inside a bigger rectangle
- Minimum number of cuts required to make circle segments equal sized
- Source to destination in 2-D path with fixed sized jumps
- Count rectangles generated in a given rectangle by lines drawn parallel to X and Y axis from a given set of points
- Intersecting rectangle when bottom-left and top-right corners of two rectangles are given
- Smallest square formed with given rectangles
- Count of Rectangles with area K made up of only 1s from given Binary Arrays
- Total number of unit cells covered by all given Rectangles
- Pizza cut problem (Or Circle Division by Lines)
- Puzzle | Cut Blue Painted Cube
- Minimum squares to evenly cut a rectangle
- Find if there exists multiple ways to draw line through (x, y) to cut rectangle in equal halfs
- Number of ways to cut a stick of length N into in even length at most K units long pieces
- Find if two rectangles overlap
- Create a matrix with alternating rectangles of O and X
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.