(CF #257) C. Jzzhu and Chocolate,
Jzzhu has a big rectangular chocolate bar that consistsNLimit × limitMUnit squares. He wants to cut this bar exactlyKTimes. Each cut must meet the following requirements:
- Each cut shoshould be straight (horizontal or vertical );
- Each cut shoshould go along edges of unit squares (it is prohibited to divide any unit chocolate square with cut );
- Each cut shoshould go inside the whole chocolate bar, and all cuts must be distinct.
The picture below shows a possible way to cut a 5 rows × six 6 chocolate for 5 times.
Imagine Jzzhu have madeKCuts 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 exactlyKCuts? The area of a chocolate piece is the number of unit squares in it.
Input
A single line contains three integersN, Bytes,M, Bytes,K(1 digit ≤ DigitN, Bytes,MLimit ≤ limit 109; 1 limit ≤ limitKLimit ≤ limit 2-109 ).
Output
Output a single integer representing the answer. If it is impossible to cut the big chocolateKTimes, print-1.
Sample test (s) input
3 4 1
Output
6
Input
6 4 2
Output
8
Input
2 3 4
Output
-1
Note
In the first sample, Jzzhu can cut the chocolate following the picture below:
In the second sample the optimal division looks like this:
In the third sample, it's impossible to cut a 2 rows × every 3 chocolate 4 times.
Ah, ah, I didn't write it out. I used to think about it for two points, but it's hard to understand what others think ..
# Include <iostream> # include <cstdio> # include <cstring> # include <algorithm> using namespace std; int main () {long n, m, k; while (cin> n> m> k) {long maxn = 0; if (k> n + m-2) {cout <-1 <endl; continue;} if (k <n) maxn = max (maxn, m * (n/(k + 1 ))); // k knives are divided into k + 1 points if (k <m) maxn = max (maxn, n * (m/(k + 1 ))); if (k> = n) maxn = max (maxn, m/(k-n + 2); // (k-(n-1) + 1; if (k> = m) maxn = max (maxn, n/(k-m + 2); cout <maxn <endl;} return 0 ;}
Cf cheats (all)
Add this person QQ6 0 5 9 6 0 7 7 6, his space has a lot of gun training tips, very full, look at it. As for the gun flushing, you can enter the game normally first. Remember to enter the room after selecting a channel.
Click the game mall and find the gun you want to brush,
(Note) First add a gun to your favorites, and then place the gun to the product you want to pay attention to (remember this step) * The point is that you can purchase the gun, it will pop up a prompt that you are not enough money,
Now, when you want to confirm, immediately press Ctrl + F5 and hold down !!
The intermediate time interval must be between 0.5 and ~ This is very important within 1 second !!
Then click Remove in the product you want to pay attention to (the two keys are still not placed), then open F5 and Press Esc immediately (Ctrl will never be placed) if you press the button for a couple of seconds, you will find that you have been out of the mall and will automatically return to the login page. This means you have succeeded! *
Then you go back to the personal warehouse to see if you want more guns!
However, this gun is not the same as buying it with money. There are time limits for the gun to be used in a few days, but there is no time limit for the gun, just like what the system sends you! Magic. * Haha, go and play. Is very simple,
However, pay attention to a few points. The time is strictly based on what I said. There is also a gun that must be placed on the products that interest you. It will take a few times to practice it, but you can only brush it, you don't have to refresh your phone, but you don't know what's going on in the desert storm. It's good for everyone to have fun,
If it succeeds, congratulations. If it fails, you will have to do more exercises. Hope to adopt
How to subscribe to cf
Game life = "game world =" find the fire line = "and subscribe