You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
610 B
C++

#include <cstdio>
double min(double a, double b) { return a < b ? a : b; };
double max(double a, double b) { return a > b ? a : b; };
double dfs(double x, double y, int t)
{
if (t == 1) return max(x / y, y / x);
double ans = 1e300;
for (int i = 1; i <= t / 2; i++)
ans = min(ans, min(
max(dfs(x / t * i, y, i), dfs(x / t * (t - i), y, t - i)),
max(dfs(x, y / t * i, i), dfs(x, y / t * (t - i), t - i))));
return ans;
}
int main()
{
int n, m, k;
scanf("%d%d%d", &n, &m, &k);
printf("%.6lf", dfs(n, m, k));
return 0;
}