UVA - 11346 Probability (概率)
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 (概率)的更多相关文章
- uva 11346 - Probability(概率)
option=com_onlinejudge&Itemid=8&page=show_problem&problem=2321">题目链接:uva 11346 - ...
- UVA 11346 Probability 概率 (连续概率)
题意:给出a和b,表示在直角坐标系上的x=[-a,a] 和 y=[-b,b]的这样一块矩形区域.给出一个数s,问在矩形内随机选择一个点p=(x,y),则(0.0)和p点组成的矩形面积大于s的概率是多少 ...
- uva 11346 - Probability(可能性)
题目链接:uva 11346 - Probability 题目大意:给定x,y的范围.以及s,问说在该范围内选取一点,和x,y轴形成图形的面积大于s的概率. 解题思路:首先达到方程xy ≥ s.即y ...
- UVa 11346 Probability (转化+积分+概率)
题意:给定a,b,s,在[-a, a]*[-b, b]区域内任取一点p,求以原点(0,0)和p为对角线的长方形面积大于s的概率. 析:应该明白,这个和高中数学的东西差不多,基本就是一个求概率的题,只不 ...
- UVA - 11346 Probability(概率)(连续概率)
题意:在[-a, a]*[-b, b]区域内随机取一个点P,求以(0, 0)和P为对角线的长方形面积大于S的概率(a,b>0, S>=0). 分析: 1.若长方形面积>S,则选取的P ...
- UVa 11346 - Probability(几何概型)
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- UVA 11346 - Probability 数学积分
Consider rectangular coordinate system and point L(X, Y ) which is randomly chosen among all pointsi ...
- UVA 11346 Probability (几何概型, 积分)
题目链接:option=com_onlinejudge&Itemid=8&page=show_problem&problem=2321">https://uva ...
- ●UVa 11346 Probability
题链: https://vjudge.net/problem/UVA-11346题解: 连续概率,积分 由于对称性,我们只用考虑第一象限即可. 如果要使得面积大于S,即xy>S, 那么可以选取的 ...
随机推荐
- bzoj 1010 [HNOI2008]玩具装箱toy(DP的斜率优化)
1010: [HNOI2008]玩具装箱toy Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 7874 Solved: 3047[Submit][St ...
- Vagrant 集群的部署
使用Vagrant部署集群 一.运行多个虚拟机 我们通过配置Vagrantfile配置两个虚拟机--web服务器和数据库服务器. Vagrant::configure("2") d ...
- the identity used to sign the executable is no longer valid.解决方法
the identity used to sign the executable is no longer valid.解决方法 一.重新下载Provisioning Profile 1.到devel ...
- oGitHub 注册
GitHub 注册 要想使用 GitHub 第一步当然是注册 GitHub 账号: 1.首先打开 https://github.com/pricing 进行注册. 2.在打开的页面中点击「Sign u ...
- Java中实例方法,实例变量,静态方法,静态变量,final方法重写的问题,覆盖
Java中只有非私有的实例方法能被重写,即实现多态,子类可以覆盖父类的方法,但是实例变量不能覆盖,若子类和父类均定义了同样名称的变量,则对于子类来说这是两个不同的变量,要想调用父类的变量必须显示去调用 ...
- [Angular 2] Validation
Define a filed should has validation: export class DemoFormSku { myForm: ControlGroup; sku: Abstract ...
- iOS中sqlite3操作
声明:下面命令我没有所有使用过, 仅用于收藏, 欢迎大家指出当中的错误 'SELECT count(*) FROM sqlite_master WHERE type="table&qu ...
- UML中的图
用例图.类图.包图.顺序图.协作图.状态图.活动图.构件图.部署图等 1.用例图 显示多个外部参与者以及他们与系统提供的用例之间的连接.用例是系统中的一个可以描述参与者与系统之间交互作用功能单元.用例 ...
- ios中框架介绍
ios中框架介绍 参考博客: 参考文章:框架介绍 框架介绍 框架就是一个目录,一个目录包含了共享库,访问共享库里面的代码的头文件,和其他的图片和声音的资源文件.一个共享库定义的方法和函数可以被应用程序 ...
- 500 OOPS: vsftpd: refusing to run with writable root inside chroot()解决方法
vsftpd.conf配置文件如下: [root@rusky ~]# cat /etc/vsftpd/vsftpd.conf | grep -v "#" anonymous_ena ...