一看n=10,大力dfs啊。。。每次切的长度一定x/n的倍数。
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int N,X,Y;
double dfs(double x,double y,double n) {
if(n==1) {return max(x,y)/min(x,y);}
double mn=999999999;
for(int i=1;i<n;i++) {
mn=min(mn,max(dfs(x,y*i/n,i),dfs(x,y*(n-i)/n,n-i)));
mn=min(mn,max(dfs(x*i/n,y,i),dfs(x*(n-i)/n,y,n-i)));
}
return mn;
}
int main() {
scanf("%d%d%d",&X,&Y,&N);
double ans=dfs(X,Y,N);
printf("%.6lf",ans);
}