Submission #15806

# Submission time Handle Problem Language Result Execution time Memory
15806 2015-07-29T11:27:33 Z didw 맛있는 과자 (kriii3_A) C++
0 / 33
0 ms 1840 KB
#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 > coef[n][idx]) {
        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
1 Incorrect 0 ms 1840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -