The Storm! So far I'm still not searching!
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm>using namespace STD; #define REP (I,s,t) for (int. i=s;i<=t;i++) #define DWN (i,s,t) for (int i=s;i>=t;i--) #define CLR (x,c) memset (X,c, sizeof (x)) double mins (double &a,double b) { if (a>b) a=b;} Double Dfs (double x,double y,int cnt) { if (cnt==1) return Max (y/x,x/y); Double ans=100000.0; Rep (i,1, (cnt>>1)) { mins (Ans,max (DFS (x*i/cnt,y,i), DFS (x* (cnt-i)/cnt,y,cnt-i)); mins (Ans,max (DFS (x,y*i/cnt,i), DFS (x,y* (cnt-i)/cnt,cnt-i))); } return ans;} int main () { double x,y;int cnt; scanf ("%lf%lf%d", &x,&y,&cnt); printf ("%.6lf\n", DFS (X,Y,CNT)); return 0;}
1024x768: [SCOI2009] Happy Birthday time limit:1 Sec Memory limit:162 MB
submit:2327 solved:1689
[Submit] [Status] [Discuss] Description
Windy's birthday, in order to celebrate his birthday, his friends helped him to buy a side length of X and Y, respectively, a rectangular cake. Now includes windy
, there are a total of N people to divide this big cake, require everyone to get the same area of cake. Windy Solo, everything can only be parallel to a piece of cake
Side (on either side) and must cut the cake into two pieces. In this way, to cut into n pieces of cake, windy must cut N-1 times. To make
Each cake looks beautiful, we require the maximum value of the ratio of the long and short sides of the N-piece cake to the smallest. Can you help windy to find out the ratio?
Input
Contains three integers, X Y N. 1 <= x, y <= 10000; 1 <= N <= 10
Output
Contains a floating-point number that retains 6 decimal places.
Sample Input5 5 5Sample Output1.800000HINT Source [Submit] [Status] [Discuss]
bzoj1024: [SCOI2009] Happy Birthday