This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<cstdio>
#include<cmath>
long long d[44][44];
int main()
{
double res;
int i,j,a,b,n;
long long k;
scanf("%d%d%d%lld",&a,&b,&n,&k);
if(a<b)a^=b^=a^=b;
for(i=0;i<=n;i++)
{
d[i][0]=d[i][i]=1;
for(j=1;j<i;j++)d[i][j]=d[i-1][j]+d[i-1][j-1];
}
for(j=0;j<=n;j++)
{
if(k>d[n][j])k-=d[n][j];
else break;
}
res=log(a*b/2.);
for(i=0;i<j;i++)res+=log(1.*b*b/(a*a+b*b));
for(i=j;i<n;i++)res+=log(1.*a*a/(a*a+b*b));
printf("%.12lf\n",res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |