F.A.Qs Home ProblemSet Status Ranklist Contest LoginRegister
大视野在线测评-欢迎您
[ New Thread ]
Problem 1024 >> 为什么tle?
wsm000 @ 2019-01-21 16:39:43
[ Quote ] [ Edit ] [ Delete ] 1#
#include<bits/stdc++.h>
using namespace std;
#define r(i,a,b) for(register int (i)=(a);(i)<=(b);(i)++)
inline int read() {
int X=0,w=1; char c=getchar();
while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
return X*w;
}
inline double dfs(double x,double y,int k){
if(k==1) { return max(x,y)*1.0/min(x,y);}
double ans=233333333,mx=x/k,my=y/k,t1,t2;
r(i,1,k/2){
t1=max(dfs(mx*i,y,i),dfs(x-mx*i,y,k-i));
t2=max(dfs(x,my*i,i),dfs(x,y-my*i,k-i));
ans=min(ans,min(t1,t2));
}
return ans;
}
int main()
{
int n=read(),x=read(),y=read();
printf("%.6lf\n",dfs(x,y,n));
return 0;
}
rt
[Top] [Previous Page] [Next Page]

HOME Back