Given two integers , . Find the number of rectangles of size 2*1 can be placed inside a rectangle of size n*m.
- No two small rectangles overlap.
- Each small rectangle lies entirely inside the large rectangle. It is allowed to touch the edges of the large rectangle.
Input : n = 3, m =3 Output : 4 Input : n = 2, m = 4 Output : 4
- If N is even, then place M rows of N/2 small rectangles and cover the whole large rectangle.
- If M is even, then place N rows of M/2 small rectangles and cover the whole large rectangle.
- If both are odd then cover N – 1 row of the board with small rectangles and put floor(M/2) small rectangles to the last row. In the worst case (N and M are odd) one cell remains uncovered.
Below is the implementation of the above approach:
- Count the number of rhombi possible inside a rectangle of given size
- Largest subset of rectangles such that no rectangle fit in any other rectangle
- Intersecting rectangle when bottom-left and top-right corners of two rectangles are given
- Find a subarray whose sum is divisible by size of the array
- Sum of Area of all possible square inside a rectangle
- Coordinates of rectangle with given points lie inside
- Find array using different XORs of elements in groups of size 4
- Check whether a given point lies on or inside the rectangle | Set 3
- Check if a point lies on or inside a rectangle | Set-2
- Check whether a given point lies inside a rectangle or not
- Find the minimum number of rectangles left after inserting one into another
- Number of GP (Geometric Progression) subsequences of size 3
- Find the minimum sum of distance to A and B from any integer point in a ring of size N
- Number of arrays of size N whose elements are positive integers and sum is K
- Find all rectangles filled with 0
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.