Sphere Online Judge

SPOJ Problem Set (classical)

4300. Rectangles

Problem code: AE00

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

Task author: Jakub Radoszewski.


Added by:Race with time
Date:2009-05-03
Time limit:1s
Source limit:50000B
Languages:All except: CLOJ ERL F# JS PERL 6 TECS
Resource:Algorithmic Engagements 2009

hide comments
2010-08-31 17:46:48 hariharan
can the program be completed in less than O(n^2) time i used 2 for loops (nested )and i m getting time limit exceeded
2010-08-07 22:16:34 David Gomez
PDF link is not working
2010-05-18 07:49:01 Kuntal Ghosh
yeah,this is correct...
2010-04-22 20:33:13 Rúben Geraldes
I'm getting "wrong answer"...I must be missing something. To small inputs I think the output is correct, the problem should be a mistake to bigger input cases.

Just to get some lights...my output on a 10000 input is 46884.

Can anybody confirm if this is correct ?
2010-03-19 09:24:06 chakra
square is also a rectangle
(i.e.) square can be derived from rectangle
2010-02-15 03:25:29 Rodrigo Salazar
@tinku: rectangle has 4 sides, with 4 right angles

Last edit: 2010-02-15 03:26:16
2010-02-09 17:14:33 Raj
how can 1x1 be a rectangle?
SPOJ System © 2010 Sphere Research Labs. All Rights Reserved.