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.


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


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.


For the input data:


the correct result is:


Task author: Jakub Radoszewski.

hide comments
akash1234: 2019-01-05 13:21:38

Ac in one go

spd123: 2019-01-01 17:08:18

Last edit: 2019-01-01 17:17:05
morphin3: 2018-12-11 20:15:53

AC in one go!

Last edit: 2018-12-11 20:18:24
Joeffison [UFCG]: 2018-10-11 09:17:21

I got the pattern.
Hint: Try n until 10 (when you're reaching the 3rd line, you'll see the pattern)
My solution takes O(√n)

kamran_: 2018-09-30 02:07:24

can we solve in O(1) time

laidactienbn: 2018-09-24 16:25:30

Helpppp!!!! I count for each factor of N
Factor i, multiple it from 1 to int(N/i) and get the total answer but it's wrong, can you guys give me some more example? About n = 60?

Last edit: 2018-09-24 16:27:59
laidactienbn: 2018-09-23 12:26:44

Last edit: 2018-09-23 12:27:47
fraxz: 2018-09-19 09:01:15

It is just an easy math... You can solve it using 2 loops. But you need to do a little bit of optimization. Hint:- You can do it in o(sqrt(n))

yamone_123: 2018-08-05 09:10:18

Ac in one go! so ez

puddin: 2018-06-23 12:18:09

try to see or figure out some formula,hint:loop will run upto sqrt(n) to calculate sum*******TC (root_n)

Added by:Race with time
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