【数据规模和约定】
100%的数据,满足 1 <= X,Y <= 10000 ; 1 <= N <= 10 。
Day1
#include<stdio.h> #include<string.h> #include<string.h> #include<iostream> #include<algorithm> #include<bitset> #include<vector> #include<queue> #include<stack> using namespace std; #define MAXX 2147483647 int X,Y,N; double work(double x,double y,int now) { double ans=MAXX,max1,max2,t; if(now==1) { if(y<x) t=y,y=x,x=t; return y/x; } for(int i=1;i<now;i++) { max1=max(work(x/now*i,y,i),work(x/now*(now-i),y,now-i)); max2=max(work(x,y/now*i,i),work(x,y/now*(now-i),now-i)); ans=min(ans,min(max1,max2)); } return ans; } int main() { scanf("%d%d%d",&X,&Y,&N); printf("%.6lf\n",work(X,Y,N)); return 0; }转载注明出处: http://blog.csdn.net/u011400953