Submission #15802

# Submission time Handle Problem Language Result Execution time Memory
15802 2015-07-29T10:57:10 Z didw 맛있는 과자 (kriii3_A) C++
0 / 33
0 ms 1828 KB
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

double rs, rb;

double solve(double S0, int n, long long k) {
    if (n == 0)
        return S0;
    // k가 전체 과자 개수보다 크다면 작은 과자조각으로 반환
    if (k > (1<<n)/2) {
        return solve(S0+rs, n-1, k/2);
    }
    // 아니면 큰 조각으로 반환
    return solve(S0+rb, n-1, k);
}

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);
    printf("%.12f\n", solve(S0, n, k));
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1828 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -