UVA 11346 - Probability 数学积分

Consider rectangular coordinate system and point L(X, Y ) which is randomly chosen among all points
in the area A which is de?ned in the following manner: A = {(x, y)|x ∈ [−a; a];y ∈ [−b; b]}. What is
the probability P that the area of a rectangle that is de?ned by points (0,0) and (X, Y ) will be greater
than S?
Input
The number of tests N ≤ 200 is given on the ?rst line of input. Then N lines with one test case on
each line follow. The test consists of 3 real numbers a > 0, b > 0 ir S ≥ 0.
Output
For each test case you should output one number P and percentage ‘%’ symbol following that number
on a single line. P must be rounded to 6 digits after decimal point.
Sample Input
3
10 5 20
1 1 1
2 2 0
Sample Output
23.348371%
0.000000%
100.000000%

题解:给你x,y,s,问说在x,y与x,y轴形成的矩形内选取一点,和x,y轴形成图形的面积大于s的概率。

题解:

      画个图是求个积分

      S = s* (ln(x1)- ln(x));

#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <bitset>
using namespace std ;
typedef long long ll;

const int N = 3000 + 5;

int main () {
    int T;
    scanf("%d",&T);
    while(T--) {
            double x,y,s;
        scanf("%lf%lf%lf",&x,&y,&s);
        double x1 = min(x,s / y);
        double S = 0;
        if(s > 1e-9) S = x1 * y + s * (log(x) - log(x1));
        //cout<<S<<endl;
        double p = 1.0 - S / (x * y);
        p *= 100;
        printf("%.6f%%\n", p);
    }
    return 0;
}

daima

时间: 2024-11-02 00:50:07

UVA 11346 - Probability 数学积分的相关文章

UVa 11346 Probability (转化+积分+概率)

题意:给定a,b,s,在[-a, a]*[-b, b]区域内任取一点p,求以原点(0,0)和p为对角线的长方形面积大于s的概率. 析:应该明白,这个和高中数学的东西差不多,基本就是一个求概率的题,只不过更简单了,不用你算了,你给出表达式, 让计算机帮你算即可. 由对称性知道,只要求[a, b]区域内的概率就OK了,也就是xy > s,由高中的知识也知道应该先求xy = s的曲线, 然后求在曲线上面的面积,这就用到了积分,由于上面的不好求,我们先求下面的,再用总面积减掉即可(自己画个图看看), 挺

UVA 11346 - Probability(概率)

UVA 11346 - Probability 题目链接 题意:给定a,b,s要求在[-a,a]选定x,在[-b,b]选定y,使得(0, 0)和(x, y)组成的矩形面积大于s,求概率 思路:这样其实就是求xy > s的概率,那么画出图形,只要求y = s / x的原函数, y = slnx,带入两点相减就能求出面积,面积比去总面积就是概率 代码: #include <cstdio> #include <cstring> #include <cmath> int

uva 11346 - Probability(可能性)

题目链接: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&g

Uva 11346 Probability 积分

化成反比函数求积分 G - Probability Time Limit: 1 sec Memory Limit: 16MB Consider rectangular coordinate system and point L(X,Y) which is randomly chosen among all points in the area A which is defined in the following manner: A = {(x,y) | x is from interval [

UVA 11346 Probability (几何概型, 积分)

题目链接:option=com_onlinejudge&Itemid=8&page=show_problem&problem=2321">https://uva.onlinejudge.org/index.php? option=com_onlinejudge&Itemid=8&page=show_problem&problem=2321 题目大意:在A是一个点集 A = {(x, y) | x ∈[-a, a],y∈[-b, b]},求取出

UVA - 11346 Probability (概率)

Description G - Probability Time Limit: 1 sec Memory Limit: 16MB Consider rectangular coordinate system and point L(X,Y) which is randomly chosen among all points in the area A which is defined in the following manner: A = {(x,y) | x is from interval

●UVa 11346 Probability

题链: https://vjudge.net/problem/UVA-11346题解: 连续概率,积分 由于对称性,我们只用考虑第一象限即可. 如果要使得面积大于S,即xy>S, 那么可以选取的点必须在双曲线xy=S的第一象限那一支的左上方. 也就是要求左下角在原点,长宽分别为a,b的矩形与双曲线的一支围成的面积. 所以由积分可得:我们要求的面积$$S'=a×b-S-S×\int_{S/b}^{a}\frac{1}{x}dx$$ 因为$y=\frac{1}{x}$的原函数为$y=ln(x)$ 所

uva 11181 - Probability|Given

条件概率公式:P( A|B ) = P( AB ) / P( B ) 表示在事件B发生的前提下,事件A发生的概率: 对本道题: 设事件E:r个人买了东西: 事件Ei:第i个人买了东西: 则要求的是P( Ei | E ); 计算P( E ) 用全概率公式即可,采用递归枚举出所有r个人买东西的情况,然后计算出其总的概率: 计算P( Ei ) 就是在上面递归枚举的过程中将选上第i个人的情况的概率加起来:(在这种情况下,其概率就是:在E发生的前提下的概率) 代码: #include<cstdio> #

概率论 --- Uva 11181 Probability|Given

Uva 11181 Probability|Given Problem's Link:   http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18546 Mean: n个人去逛超市,第i个人会购买东西的概率是Pi.出超市以后发现有r个人买了东西,问你每个人购买东西的实际概率是多少. analyse: 转换模型: 有n个员工,每个员工被选出来的概率是Pi.最后选出了r个,问你第i个员工在这r个中的概率是多少. 设: 事件A---