HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Kovrov IT > problem:


2007.C. 50640 - Cubes

Guest
• Discussion of problem (1)

Volume problems

• 2007.A. 50671 - Phalanx
• 2007.B. 50270 - Bitsorting
• 2007.C. 50640 - Cubes
• 2007.D. 50271 - Factorial
• 2007.E. 50663 - Lights
• 2007.F. 50690 - Parliament
• 2007.G. 50272 - Strange Numbers
• 2007.H. 50273 - Two Captains
• 2007.I. 50274 - Boundary Troops
• 2007.J. 50275 - Wedding
• 2007.K. 50276 - Nice Floor

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Автор: Михаил Копачев, РГАТА. Difficulty Beta

Vasya and Petya are playing with cubes. Each of them has brought his own box of cubes to play with. The boxes previously contained an equal number of cubes (k), but after Petya has lost one of them, he has one cube less. The boys' cubes are quite identical, so they can be used to assemble various flat structures (solid one-layer figures with contacting sides).
It is known that using all the cubes (except lost) the boys can assemble a square (each side of the square having the same number of cubes), but cannot assemble any other rectangle.
What is the largest number of the cubes that the box can contain, if we know that the total number of the cubes the boys have got does not exceed n?
Your task is to make a program that will use the specified number n to define the maximum k (the number of the cubes in Vasya's box) and fit the problem specification.

Input
The input contains only one integer n.
Output
The output should contain only one integer k.
Limitations
10 ≤ n ≤ 109.

Input 1 Output 1
10
5
Input 2 Output 2
25
13

Для отправки решений необходимо выполнить вход.

www.contester.ru