11346-probability (probability)

Source: Internet
Author: User

Link to the question: Ultraviolet A 11346-Probability

Given the range of X and Y, and s, the probability that the area of the image formed by X and Y axes is larger than S is given.

Solution: first, the Equation xy ≥ s, that is, y = s/X.


The area of S2 is calculated using credits. The original function of Y = s/X is lnx.
So S2 = s? (LN ()? 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\n",  fabs(p * 100), ‘%‘);    }    return 0;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.