Problem C. Jzzhu and Chocolate

时间限制 1000 ms   内存限制 256 MB

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.

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.

输入数据

A single line contains three integers n, m, k(1 ≤ n, m ≤ 109; 1 ≤ k ≤ 2·109).

输出数据

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

样例

样例说明

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

dbf76f376f38f0a80ce3c29a71d9f93d34e62e2f.png

In the second sample the optimal division looks like this:

fb510c2288c2444d4ba9676454d01a47337cf03f.png

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

提交

请先 登录

© 2025 FAQs Contact About