Codeforces Round 257 (Div. 1)
A
Jzzhu and Chocolate
Codeforces
1700
原题
←B →
翻译中…

Jzzhu has a big rectangular chocolate bar that consists of $*n* × *m*$ unit squares. He wants to cut this bar exactly $*k*$ times. Each cut must meet the following requirements:

翻译中…
  • each cut should be straight (horizontal or vertical);
  • each cut should go along edges of unit squares (it is prohibited to divide any unit chocolate square with cut);
  • each cut should go inside the whole chocolate bar, and all cuts must be distinct.
翻译中…

The picture below shows a possible way to cut a $5 × 6$ chocolate for $5$ times.

翻译中…

image

翻译中…

Imagine Jzzhu have made $*k*$ cuts and the big chocolate is splitted into several pieces. Consider the smallest (by area) piece of the chocolate, Jzzhu wants this piece to be as large as possible. What is the maximum possible area of smallest piece he can get with exactly $*k*$ cuts? The area of a chocolate piece is the number of unit squares in it.

翻译中…

Input

翻译中…

A single line contains three integers $*n*, *m*, *k*$ $(1 ≤ *n*, *m* ≤ 10^{9}; 1 ≤ *k* ≤ 2·10^{9})$.

翻译中…

Output

翻译中…

Output a single integer representing the answer. If it is impossible to cut the big chocolate $*k*$ times, print -1.

翻译中…

Note

翻译中…

In the first sample, Jzzhu can cut the chocolate following the picture below:

翻译中…

image

翻译中…

In the second sample the optimal division looks like this:

翻译中…

image

翻译中…

In the third sample, it's impossible to cut a $2 × 3$ chocolate $4$ times.

翻译中…

样例

Input #1
3 4 1
Output #1
6
InputCopy OutputCopy
Input #2
6 4 2
Output #2
8
InputCopy OutputCopy
Input #3
2 3 4
Output #3
-1
InputCopy OutputCopy
题目信息
题号
449A
时间限制
1 s
内存限制
256 MB
标签
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。