思路:直接根据题意爆搜(dfs)就可以了。
代码如下:

#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
double x,y;
int n;
double dfs(double x,double y,int cnt){
    if(cnt==1){
        if(x<y) swap(x,y);      //long / short
        return x/y;
    }
    double minn=10000.0,maxx=0.0;
    double xx=x/cnt,yy=y/cnt;
    for(int i=1;i<cnt;i++){
        maxx=dfs(x-xx*i,y,cnt-i);
        maxx=max(maxx,dfs(xx*i,y,i));
        minn=min(maxx,minn);
    }
    for(int i=1;i<cnt;i++){
        maxx=dfs(x,y-yy*i,cnt-i);
        maxx=max(maxx,dfs(x,yy*i,i));
        minn=min(maxx,minn);
    }
    return minn;
}
int main()
{
    scanf("%lf %lf %d",&x,&y,&n);
    printf("%.6f\n",dfs(x,y,n));
}