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, 那么可以选取的 ...
随机推荐
- 关于 NoSQL 数据库你应该了解的 10 件事
四分之一个世纪以来,关系型数据库(RDBMS)一直是主流数据库模型.但是现在非关系型数据库,“云”或者“NoSQL”数据库,正在作为一种替代数据库模型获得越来越多的占有率.本文中我们将关注非关系型 N ...
- Python开发—Ajax系列
概述 对于WEB应用程序:用户浏览器发送请求,服务器接收并处理请求,然后返回结果,往往返回就是字符串(HTML),浏览器将字符串(HTML)渲染并显示浏览器上. 1.传统的Web应用 一个简单操作需要 ...
- ECLIPSE TOMCAT CONFIG JSTL
{LJ?Dragon}[标题]Eclipse 配置 JSTL标签库 {LJ?Dragon}[Diary]2017年,愉快的开始:当和他们离别时,感觉失去了整个世界......... 1.JSTL简 ...
- JAVA大数类
JAVA大数类api http://man.ddvip.com/program/java_api_zh/java/math/BigInteger.html#method_summary 不仅仅只能查J ...
- oracle日期时间函数总结
常常写 sql 的同学应该会接触到一些 oracle 的日期时间函数, 比如: 財务软件或者人力资源软件须要依照每年, 每季度, 每月, 甚至每一个星期来进行统计. 今天闲来没事, 特意从网上整理了一 ...
- [ES6] Array.findIndex()
In es5, you can use indexOf to get the index of one item in an array. In es6, you can use findIndex( ...
- java.lang.Math中的基本方法
java.lang.Math类提供的方法都是static的,“静态引入 ”使得不必每次在调用类方法时都在方法前写上类名: import static java.lang.Mat ...
- Meth | 安装Linux Mint 18以后grub2 win10启动引导项丢失??!!
进入mint,打开终端输入:sudo update-grub2
- [转] Java多线程发展简史
这篇文章,大部分内容,是周五我做的一个关于如何进行Java多线程编程的Knowledge Sharing的一个整理,我希望能对Java从第一个版本开始,在多线程编程方面的大事件和发展脉络有一个描述,并 ...
- Ubuntu install mysql
sudo apt-get install mysql-server sudo apt-get install libmysqlclient-dev