(CF#257)C. Jzzhu and Chocolate,
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 exactlyk 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 ≤ 109; 1 ≤ k ≤ 2·109).
Output
Output a single integer representing the answer. If it is impossible to cut the big chocolate k times, 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 × 3 chocolate 4 times.
啊啊啊啊,沒寫出來,原來想二分來著,可是不好弄,看別人思路做的,其實也挺好理解的。。
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int main(){ long long n,m,k; while(cin>>n>>m>>k) { long long maxn=0; if(k>n+m-2) { cout<<-1<<endl; continue; } if(k<n) maxn=max(maxn,m*(n/(k+1)));//k刀分成k+1分 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秘籍(全)
加這個人QQ6 0 5 9 6 0 7 7 6,他空間裡有不少練槍秘籍,很全,看看吧。至於刷槍,首先正常進入遊戲,隨便選一個頻道後 要記得進入房間
現在點遊戲商城,找到你想刷的槍,
(注意了)先在槍的下面點收藏,然後把槍放到關注商品 (這一步一定要記得)*重點到了,接著你點購買,它會彈出一個匡 提示你錢不夠 對把,
現在,在你要點確定的時候,立刻按住Ctrl加F5,按住不放!!
這中間時間間隔一定要把握在0.5~1秒之間,這點非常重要!!
然後在你關注商品中點解除(那兩個鍵還是按著不放),這時放開F5馬上按Esc,(Ctrl始終不放) 按住個兩妙 左右你會發現你被卡出商城了,會自動回到剛登陸的頁面,這就說明你成功了!*
這時你回到個人倉庫去看是不是多了把你想要的槍!
不過這槍跟花錢買的不一樣,花錢的槍下面都有時間限制說你還有幾天可以用,而這把卡出的槍下面卻沒有時間限制,就跟系統送你的一樣!神奇把。*呵呵,去玩把。是很簡單,
不過要注意幾點,時間嚴格按我說的,還有就是槍一定要放到關注商品上就行了,多練幾次就會了,不過你只能刷一把,別得再刷會掉線,而且那把沙漠風暴不知道怎麼回事始終刷不出來,反正大家玩的開心就好啦,
要是成功的那祝賀喔,不成功的多練習。 望採納
怎訂閱cf(穿越火線
遊戲人生=》遊戲世界 =》找到穿越火線=》然後訂閱