Олимпиадный тренинг

Задача 33529. Parade


Задача

Темы: Циклы
M soldiers are taking part in the parade. The parade command decided that the most spectacular formation of the military – in the form of a square, that is, the number of participants in the construction
should be an exact square. But since the number M may not be an exact square, it is allowed to divide the military into several regiments, each of which is built in the form
square. For beauty, all regiments should be the same size, and the parade command also wants the size of each regiment to be as large as possible. Determine the maximum possible shelf size.
The program receives as input one positive integer M, not exceeding 2×109, – the number of participants in the parade. The program should output one number – maximum shelf size.
Input Output
180 36