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 int a,b,n,k;
long long int c[50][50];
int main()
{
scanf("%lld %lld %lld %lld",&a,&b,&n,&k);
if(a<b)
{
long long int tt = a;
a = b;
b = tt;
}
int i, j;
c[0][0]=1;
for(i=1;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];
}
}
i=0;
while(1)
{
if(k <= c[n][i])break;
k -= c[n][i];
i++;
}
double aa = log(a)*2;
double bb = log(b)*2;
double cc = log(a*a+b*b)*n;
printf("%.10lf\n",aa*(n-i) + bb*i - cc + log(a*b/2.0));
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |