BZOJ 1024: [SCOI2009]生日快乐|暴力

这才是真正的暴力(银雀斯汀)

水了一发

#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<iostream>
#include<algorithm>
#define T 999999999
using namespace std;
double x,y;
int n;
double dfs(double x,double y,int n)
{
	if(x>y)swap(x,y);
	if(n==1)return y/x;
	double ans=T;
	for(int i=1;i<=n/2;i++)
		ans=min(ans,max(dfs(x,y*i/n,i),dfs(x,y*(n-i)/n,n-i)));
	for(int i=1;i<=n/2;i++)
	    ans=min(ans,max(dfs(x*i/n,y,i),dfs(x*(n-i)/n,y,n-i)));
	return ans;
}
int main()
{
	scanf("%lf%lf%d",&x,&y,&n);
	printf("%.6lf",dfs(x,y,n));
}


你可能感兴趣的:(暴力)