1 /**************************************************************
2 Problem: 1024
3 User: AsmDef
4 Language: C++
5 Result: Accepted
6 Time:16 ms
7 Memory:804 kb
8 ****************************************************************/
9
10 /***********************************************************************/
11 /**********************By Asm.Def-Wu Jiaxin*****************************/
12 /***********************************************************************/
13 #include <cstdio>
14 #include <cstring>
15 #include <cstdlib>
16 #include <ctime>
17 #include <cctype>
18 #include <algorithm>
19 #include <cmath>
20 using namespace std;
21 #define SetFile(x) ( freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout) )
22 #define getc() getchar()
23 template<class T>inline void getd(T &x){
24 char ch = getc();bool neg = false;
25 while(!isdigit(ch) && ch != ‘-‘)ch = getc();
26 if(ch == ‘-‘)ch = getc(), neg = true;
27 x = ch - ‘0‘;
28 while(isdigit(ch = getc()))x = x * 10 - ‘0‘ + ch;
29 if(neg)x = -x;
30 }
31 /***********************************************************************/
32
33 double dfs(int N, double L, double S){
34 if(L < S)swap(L, S);
35 if(N == 1)return L / S;
36 double Min = L/S*N, part = 1.0 / N, p;
37 int i, n = N / 2 - (N & 1 == 0);
38 for(i = 1;i <= n;++i){
39 p = part * i * L;
40 Min = min(Min, max(dfs(i, S, p), dfs(N-i, S, L-p)));
41 p = part * i * S;
42 Min = min(Min, max(dfs(i, L, p), dfs(N-i, L, S-p)));
43 }
44 if(N & 1 == 0)Min = min(Min, min(dfs(i, S, L / 2), dfs(i, L, S / 2)));
45 return Min;
46 }
47
48 inline void work(){
49 int X, Y, N;
50 scanf("%d%d%d", &X, &Y, &N);
51 printf("%.6lf\n", dfs(N, X, Y));
52 }
53
54 int main(){
55
56 #ifdef DEBUG
57 freopen("test.txt", "r", stdin);
58 #elif !defined ONLINE_JUDGE
59 SetFile(bzoj_1024);
60 #endif
61 work();
62
63 #ifdef DEBUG
64 printf("\n%.2lf sec \n", (double)clock() / CLOCKS_PER_SEC);
65 #endif
66 return 0;
67 }
68 ?