close

AE00 - Rectangles


Byteman has a collection of N squares with side 1. How many different rectangles can he form using these squares?

Two rectangles are considered different if none of them can be rotated and moved to obtain the second one. During rectangle construction, Byteman can neither deform the squares nor put any squares upon any other ones.

Input

The first and only line of the standard input contains one integer N (1 ≤ N ≤ 10000).

Output

The first and only line of the standard output should contain a single integer equal to the number of different rectangles that Byteman can form using his squares.

Example

For the input data:

6

the correct result is:

8

Image

Task author: Jakub Radoszewski.


hide comments
Image sushantsangwan: 2025-08-27 15:12:55

@sivan_353 how the fuck did you did this question using only if and else

Image chandu2438: 2024-03-10 15:41:55

is same vertical horizontal rectangles can come

Image axelmp: 2023-07-10 03:29:54

I have a solution in O(1) but it only gives up to case 10. Can someone tell me what is wrong?
sqrt(n) +(n-2) + ((n/2) - (sqrt(n) /2))

Image aryankk: 2021-05-28 11:33:52

hint: just find the factors of n and see that they don't repeat

Image jinks: 2020-12-31 11:05:17

Learned Something from this question, good question!

Image sivan_353: 2020-11-11 07:06:33

i did the program with simple if else but its showing time limit exceeded. why????

Image sivan_353: 2020-11-08 17:44:34

.I don't even understand the question

Image yuvrajsharma: 2020-10-06 19:32:50

this can also be done in O(sqrt(n))

Image coder582: 2020-10-06 11:44:27

I got AC in this problem, I have n*sqrt(n) complexity solution, someone please share hint for a better solution.

Image yash9274: 2020-09-22 10:57:14

Hint: think of brute force... something like
1*1 1*2 1*3 1*4...... 1*n
2*2 2*3 2*4...... 2*n/2 and so on
make these once... u'll get it


Added by:Race with time
Date:2009-05-03
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Algorithmic Engagements 2009