|All-time Popular Problems|
|Construct Tree from Inorder & Preorder|
|Sum of two large numbers|
|Level order traversal in spiral form|
|Spirally traversing a matrix|
|Angle between hour and minute hand|
|Binary Tree to DLL|
|Smallest Positive missing number|
|Height of Binary Tree|
|Largest Number formed from an Array|
You are given N unit squares (squares with side length 1 unit), the task is to make rectangles using these squares and to count the number of rotationally unique rectangles. Two rectangles are rotationally unique if one can’t be rotated to become equivalent to the other one.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains a number N i.e., number of unit squares.
For each test case, print the count of rotationally unique rectangles in new line.
For first test case: Input : N = 4 Output : 5 Total rectangles we can make from 4 unit squares are: 1x1, 1x2, 1x3, 2x2, 1x4, 2x1, 3x1, 4x1 But we can get 2x1, 3x1, 4x1 by rotating 1x2, 1x3, 1x4. So these five rectangles are rotationally unique. 1 x 1, 1 x 2, 2 x 2, 1 x 3 and 1 x 4