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>
#include <algorithm>
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long lint;
lint bino[44][44];
int main(){
for(int i=0; i<44; i++){
bino[i][0] = 1;
for(int j=1; j<=i; j++){
bino[i][j] = bino[i-1][j] + bino[i-1][j-1];
}
}
int a, b, n;
long long k;
scanf("%d %d %d %lld",&a,&b,&n,&k);
long double addi0 = log(1.0 * (a * a) / (a * a + b * b));
long double addi1 = log(1.0 * (b * b) / (a * a + b * b));
int p = 0;
for(int i=0; i<=n; i++){
if(bino[n][i] >= k){
p = i;
break;
}
k -= bino[n][i];
}
if(addi0 > addi1) swap(addi0, addi1);
cout << setprecision(30) << p * addi0 + (n - p ) * addi1 + log(a * b * 0.5);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |