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
king_25: 2019-07-30 12:09:37

AC,Hint:find factors.

Last edit: 2019-07-30 12:12:14
rikilg: 2019-07-19 13:59:52

AC in one go!

rohan_rocksss: 2019-06-02 11:26:24

AC in one go. O(n*log(n)) solution.

Last edit: 2019-06-02 11:28:18
hetp111: 2019-04-11 16:59:34

did it in O(n*sqrt(n))... =(

alfeberlin: 2019-04-04 13:15:10

See also

They also have an implementation there which does it in O(sqrt(n)), so I guess faster will not be possible (otherwise they'd state the algorithm there).

Last edit: 2019-04-04 13:19:05
harish_49: 2019-03-22 06:51:49

AC in 2 go ! haha @sqrt(n)

rahulrawat09: 2019-03-20 16:45:20

for(int i=1;i<=sqrt(n);i++)
sum+=n/i - i + 1;

souravramos04: 2019-02-22 15:23:15

Don't forget to initialize your count to 0. AC on 6th attempt.

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

Ac in one go

morphin3: 2018-12-11 20:15:53

AC in one go!

Last edit: 2018-12-11 20:18:24

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