## Editorial for COCI '07 Contest 2 #2 Crne

Remember to use this editorial

**only**when stuck, and**not to copy-paste code from it**. Please be respectful to the problem author and editorialist.**Submitting an official solution before solving the problem yourself is a bannable offence.**If Mirko makes horizontal and vertical cuts, Slavko's board will fall apart into pieces.

The first solution uses two nested for-loops to try all possible values of and (such that their sum is not greater than ) and outputs the largest product.

The second solution is to notice that it never makes sense to make less than cuts, and loops over all values of , and uses the expression for .

The third solution doesn't use any loops, instead observing that the product will be the largest if and are as close as possible. The actual expressions are , .

## Comments