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<math.h>
using namespace std;
long long pas[50][50];
int a, b, n;
long long k;
void input() {
scanf("%d %d %d %lld", &a, &b, &n, &k);
if (a > b) {
int t = a;
a = b;
b = t;
}
}
void init() {
int i, j;
for (i = 0; i <= n + 1; i++) {
for (j = 0; j <= i; j++) {
if (j == 0 || j == i) pas[i][j] = 1;
else pas[i][j] = pas[i - 1][j] + pas[i - 1][j - 1];
}
}
}
void process() {
int i;
long long sum = 0;
for (i = 0; i <= n; i++) {
sum += pas[n][i];
if (sum >= k) {
break;
}
}
double alog = log((double)(a*a) / (a*a + b*b)), blog = log((double)(b*b) / (a*a + b*b));
double S = log((double)(a*b) / 2);
printf("%.12lf\n", S + i*alog + (n - i)*blog);
}
int main() {
input();
init();
process();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |