HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


50640 - Cubes

Guest
• Discussion of problem (1)

Section problems

• 50241 - Greatest common divisor
• 50240 - The numbers that are divisi...
• 50242 - Numbers whose sum of the...
• 50248 - Power of two
• 50641 - Strong Prime Power
• 50249 - Ladders
• 50247 - Missing numbers
• 50267 - Interesting permutations
• 50640 - Cubes
• 50377 - kth Permutation
• 50341 - Separate Into Digits
• 50424 - Area
• 50335 - Five Math Operators
• 50299 - Median
• 50301 - Fractions to Decimals
• 50304 - Number Pattern
• 50305 - John's Tasks

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