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<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
long long K, C[41][41], S;
int a, b, n;
double Res;
int main()
{
int i, j, x;
scanf("%d%d%d%lld",&a,&b,&n,&K);
if(a<b)swap(a,b);
for(i=0;i<=n;i++){
C[i][0]=1;
for(j=1;j<=i;j++)C[i][j]=C[i-1][j-1]+C[i-1][j];
}
for(i=0;i<=n;i++){
S+=C[n][i];
if(S>=K)break;
}
x = i;
Res=a*b*0.5;
Res = log(Res);
for(i=1;i<=x;i++){
Res=Res+log(b*b)-log(a*a+b*b);
}
for(i=1;i<=n-x;i++){
Res=Res+log(a*a)-log(a*a+b*b);
}
printf("%.11lf\n",Res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |