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 [-a;a]; y is from interval
[-b;b]}. What is the probability P that the area of a rectangle that is defined by points (0,0) and (X,Y) will be greater than S?

INPUT:

The number of tests N <= 200 is given on the first 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%


Problem setters: Aleksej Viktorchik, Leonid Shishlo.

Huge Easy Contest #1

/* ***********************************************
Author        :CKboss
Created Time  :2015年01月29日 星期四 22时10分37秒
File Name     :UVA11346.cpp
************************************************ */

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;

double a,b,s;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

	int T_T;
	scanf("%d",&T_T);
	while(T_T--)
	{
		scanf("%lf%lf%lf",&a,&b,&s);
		if(s==0)
		{
			printf("100.000000%\n");
			continue;
		}
		else if(a*b<=s)
		{
			printf("0.000000%\n");
			continue;
		}
		double area = log(b)-log(s/a);
		double mu = 4*a*b;
		area = s + s*area;
		area*=4;
		printf("%.6lf%\n",100.*(1.-area/mu));
	}

    return 0;
}
时间: 2024-11-05 10:54:06

Uva 11346 Probability 积分的相关文章

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 数学积分

Consider rectangular coordinate system and point L(X, Y ) which is randomly chosen among all pointsin the area A which is de?ned in the following manner: A = {(x, y)|x ∈ [−a; a];y ∈ [−b; b]}. What isthe probability P that the area of a rectangle that

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 (转化+积分+概率)

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

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 1356 - Bridge(积分+二分)

题目链接:uva 1356 - Bridge 题目大意:在一座长度为B的桥上建若干个塔,塔的间距不能超过D,塔的高度为H,塔之间的绳索形成全等的抛物线.绳索的总长度为L.问在建最少塔的情况下,绳索的最下段离地面的高度. 解题思路:贪心的思想求出最少情况下建立的塔数. 二分高度,然后用积分求出两塔之间绳索的长度. C++ 积分 #include <cstdio> #include <cstring> #include <cmath> #include <algori