• uva 11346


    题目链接:uva 11346 - Probability

    题目大意:给定x。y的范围。以及s。问说在该范围内选取一点。和x,y轴形成图形的面积大于s的概率。

    解题思路:首先达到方程xy ≥ s,即y = s / x。


    S2的面积用积分计算,y = s / x的原函数为lnx
    所以
    S2=s(ln(a)ln(x))

    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <algorithm>
    
    using namespace std;
    
    int main  () {
        int cas;
        double a, b, s;
        scanf("%d", &cas);
    
        while (cas--) {
            scanf("%lf%lf%lf", &a, &b, &s);
            double r = min(s / b, a);
            double ans = r * b + log(a) * s;
    
            if (fabs(s) > 1e-9)
                ans = ans - log(r) * s;
    
            double p = 1 - ans / (a * b);
            printf("%.6lf%c
    ",  fabs(p * 100), '%');
        }
        return 0;
    }
  • 相关阅读:
    GDUFE ACM-1020
    GDUFE ACM-1069(简单的巴什博弈)
    GDUFE ACM-1138
    GDUFE ACM-1009
    GDUFE ACM-1008
    GDUFE ACM-1005
    LCA 最近公共祖先
    51nod
    51nod
    51nod
  • 原文地址:https://www.cnblogs.com/yjbjingcha/p/8405916.html
Copyright © 2020-2023  润新知