HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Kovrov IT > problem:


2007.C. 50640 - Cubes

Guest
• Discussion of problem (1)

Volume problems

• 2010.B. 50281 - Primes
• 2010.D. 50277 - Unusual Lottery
• 2010.E. 50664 - Polygons
• 2010.F. 50265 - Liars and Knights
• 2010.G. 50256 - Sequence
• 2010.H. 50282 - Coins
• 2010.I. 50257 - Galls village
• 2010.J. 50258 - String manipulations
• 2007.C. 50640 - Cubes
• 2007.D. 50271 - Factorial
• 2007.K. 50276 - Nice Floor
• 2007.A. 50671 - Phalanx
• 2007.B. 50270 - Bitsorting
• 2007.E. 50663 - Lights
• 2007.G. 50272 - Strange Numbers
• 2007.H. 50273 - Two Captains
• 2007.I. 50274 - Boundary Troops

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