Description

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%
题意:给定a,b,s要求在[-a,a]选定x,在[-b,b]选定y,使得(0, 0)和(a,b)组成的矩形面积大于s的概率
思路:只需要求第一象限的即可,转换成a*b>s的图形面积,利用求导函数求面积的方式计算,总面积为m=a*b,求所以概率为(m-s-s*log(m/s))/m.
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main (){
int num;
scanf("%d",&num);
while(num--){
double a,b,s;
scanf("%lf%lf%lf",&a,&b,&s);
if(s > a*b)
printf("0.000000%%\n");
else if(s ==)
printf("100.000000%%\n");
else{
double m = a * b;
double ans = (m - s - s * log(m/s)) / m;
printf("%.6lf%%\n",ans*);
}
}
return ;
}

UVA - 11346 Probability (概率)的更多相关文章

  1. uva 11346 - Probability(概率)

    option=com_onlinejudge&Itemid=8&page=show_problem&problem=2321">题目链接:uva 11346 - ...

  2. UVA 11346 Probability 概率 (连续概率)

    题意:给出a和b,表示在直角坐标系上的x=[-a,a] 和 y=[-b,b]的这样一块矩形区域.给出一个数s,问在矩形内随机选择一个点p=(x,y),则(0.0)和p点组成的矩形面积大于s的概率是多少 ...

  3. uva 11346 - Probability(可能性)

    题目链接:uva 11346 - Probability 题目大意:给定x,y的范围.以及s,问说在该范围内选取一点,和x,y轴形成图形的面积大于s的概率. 解题思路:首先达到方程xy ≥ s.即y ...

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

    题意:给定a,b,s,在[-a, a]*[-b, b]区域内任取一点p,求以原点(0,0)和p为对角线的长方形面积大于s的概率. 析:应该明白,这个和高中数学的东西差不多,基本就是一个求概率的题,只不 ...

  5. UVA - 11346 Probability(概率)(连续概率)

    题意:在[-a, a]*[-b, b]区域内随机取一个点P,求以(0, 0)和P为对角线的长方形面积大于S的概率(a,b>0, S>=0). 分析: 1.若长方形面积>S,则选取的P ...

  6. UVa 11346 - Probability(几何概型)

    链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  7. UVA 11346 - Probability 数学积分

    Consider rectangular coordinate system and point L(X, Y ) which is randomly chosen among all pointsi ...

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

    题目链接:option=com_onlinejudge&Itemid=8&page=show_problem&problem=2321">https://uva ...

  9. ●UVa 11346 Probability

    题链: https://vjudge.net/problem/UVA-11346题解: 连续概率,积分 由于对称性,我们只用考虑第一象限即可. 如果要使得面积大于S,即xy>S, 那么可以选取的 ...

随机推荐

  1. Theme Section - HDU 4763(KMP)

    题目大意:给你一个串,从这个串里面找出一个前缀后缀中间相等的串的最大长度也就是 EAEBE,每个字母都代表一个串,E出现了三次,找出最长的那个E.   分析:我们知道KMP里面保存的就是前缀和后缀的最 ...

  2. segment

    1.segmentedControlStyle 设置segment的显示样式. typedef NS_ENUM(NSInteger, UISegmentedControlStyle) { UISegm ...

  3. [置顶] C++中RTTI机制剖析

    C++中要想在运行时获取类型信息,可没有Java中那么方便,Java中任何一个类都可以通过反射机制来获取类的基本信息(接口.父类.方法.属性.Annotation等),而且Java中还提供了一个关键字 ...

  4. HDU 4118 树形DP Holiday's Accommodation

    题目链接:  HDU 4118 Holiday's Accommodation 分析: 可以知道每条边要走的次数刚好的是这条边两端的点数的最小值的两倍. 代码: #include<iostrea ...

  5. Linux 相关scsi命令

    Linux 相关scsi命令 由于前段时间存储扩容,对存储操作较多,下面记录了常用的操作: lsscsi命令:显示scsi设备信息 #lsscsi [0:0:0:2]    disk    IBM   ...

  6. Ubuntu系统下MySQL读取文件数据ERROR解决

    博文链接:http://haoyuanliu.github.io/2016/04/29/mysql/ 对,我是来骗访问量的!O(∩_∩)O~~ 在使用MySQL进行文件数据读取的时候,在终端敲入命令行 ...

  7. Adblock Plus完美过滤视频网站广告、无黑屏!及屏蔽非本站脚本的Adblock Plus过滤器语法之探讨

    测试用浏览器:Firefox 24.订阅的Adblock Plus过滤规则有默认的 ChinaList + EasyList,和国内视频广告规则[Yge.me],其网址:http://i.yge.me ...

  8. [转] shared_from_this 几个值得注意的地方

    http://hi.baidu.com/cpuramdisk/item/7c2f8d77385e0f29d7a89cf0 shared_from_this()是enable_shared_from_t ...

  9. Java基础知识强化之IO流笔记13:递归之不死神兔问题(斐波那契数列)

    1.这个问题是如下的:    有一对兔子,从出生后第3个月起,每个月都生一对兔子,小兔子长到第3个月又生一对兔子,加入兔子都不死,问第20个月兔子的对数? 分析:我们找规律 兔子对数第1个月:   1 ...

  10. 构建可比较的对象(IComparable)

    IComparable接口 System.IComparable接口指定了一种允许一个对象可基于某些特定键值进行排序的行为. namespace System { [ComVisible(true)] ...