DWITE Online Computer Programming Contest

Unit rectangles

December 2010
Problem 2

Rectangles can be constructed out of smaller squares. Given a supply of unit squares (1×1 in size), how many unique rectangles can be constructed?

The input file DATA2.txt will contain 5 lines, each an integer 1 ≤ N ≤ 1000 representing the number of unit squares available.

The output file OUT2.txt will contain 5 lines, each being the number of unique rectangles that can be constructed from up to N unit squares (not all squares have to be used for some of the rectangles).

Note: A rectangle is unique if another rectangle that had previously been constructed can’t be rotated to look the same way. That is, 2×3 and 3×2 are considered to be the same.

Sample Input (first 2 shown):
Sample Output (first 2 shown):