bzoj 1024 暴力深搜

我们直接暴力的深搜怎么切就行了,

每一刀切的方案只有横着和竖着,横竖又分在几等分点切,

因为要保证每个人的面积相同,所以比较好处理了,第几个几等分点就

分给这边几刀。

/**************************************************************
    Problem: 1024
    User: BLADEVIL
    Language: Pascal
    Result: Accepted
    Time:608 ms
    Memory:224 kb
****************************************************************/
 
//By BLADEVIL
var
    x, y                            :extended;
    n                               :longint;
     
function max(a,b:extended):extended;
begin
    if a>b then max:=a else max:=b;
end;
 
function min(a,b:extended):extended;
begin
    if a>b then min:=b else min:=a;
end;
 
function dfs(x,y:extended;n:longint):extended;
var
    ans, r                          :extended;
    i                               :longint;
begin
    if x>y then
    begin
        ans:=x; x:=y; y:=ans;
    end;
    if n=1 then exit(y/x);
    r:=1/n; ans:=1e20;
    for i:=1 to n-1 do
    begin
        ans:=min(ans,max(dfs(x*r*i,y,i),dfs(x-x*r*i,y,n-i)));
        ans:=min(ans,max(dfs(x,y*i*r,i),dfs(x,y-y*r*i,n-i)));
    end;
    exit(ans);
end;
 
 
begin
    read(x,y,n);
    writeln(dfs(x,y,n):0:6);
end.

 

posted on 2013-12-29 01:54  BLADEVIL  阅读(309)  评论(0编辑  收藏  举报