이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
double rs, rb;
double coef[40][40];
void calccoef() {
coef[0][0] = 1;
for (int i = 1; i < 41; ++i) {
coef[i][0] = coef[i][i] = 1;
for (int j = 1; j < i; ++j) {
coef[i][j] = coef[i-1][j-1] + coef[i-1][j];
}
}
}
int main() {
long long a, b, n, k;
cin >> a >> b >> n >> k;
if (a > b) swap(a, b);
rs = log((double)a*a / (double)(a*a + b*b));
rb = log((double)b*b / (double)(a*a + b*b));
double S0 = log(a*b / 2.0);
int idx = 0;
calccoef();
while (k > 1) {
k -= coef[n][idx];
idx++;
}
for (int i = 0; i < idx; ++i)
S0 += rs;
for (int i = idx; i < n; ++i)
S0 += rb;
printf("%.12f\n", S0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |