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 defined 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 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%
题解:给你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 = + ; 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 = ;
if(s > 1e-) S = x1 * y + s * (log(x) - log(x1));
//cout<<S<<endl;
double p = 1.0 - S / (x * y);
p *= ;
printf("%.6f%%\n", p);
}
return ;
}
daima
UVA 11346 - Probability 数学积分的更多相关文章
- UVa 11346 Probability (转化+积分+概率)
题意:给定a,b,s,在[-a, a]*[-b, b]区域内任取一点p,求以原点(0,0)和p为对角线的长方形面积大于s的概率. 析:应该明白,这个和高中数学的东西差不多,基本就是一个求概率的题,只不 ...
- uva 11346 - Probability(概率)
option=com_onlinejudge&Itemid=8&page=show_problem&problem=2321">题目链接:uva 11346 - ...
- uva 11346 - Probability(可能性)
题目链接:uva 11346 - Probability 题目大意:给定x,y的范围.以及s,问说在该范围内选取一点,和x,y轴形成图形的面积大于s的概率. 解题思路:首先达到方程xy ≥ s.即y ...
- UVA 11346 Probability (几何概型, 积分)
题目链接:option=com_onlinejudge&Itemid=8&page=show_problem&problem=2321">https://uva ...
- UVa 11346 - Probability(几何概型)
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- UVA - 11346 Probability (概率)
Description Probability Time Limit: 1 sec Memory Limit: 16MB Consider rectangular coordinate system ...
- ●UVa 11346 Probability
题链: https://vjudge.net/problem/UVA-11346题解: 连续概率,积分 由于对称性,我们只用考虑第一象限即可. 如果要使得面积大于S,即xy>S, 那么可以选取的 ...
- UVA 11346 Probability
题目描述 PDF 输入输出格式 输入格式: 输出格式: 输入输出样例 输入样例#1: 3 10 5 20 1 1 1 2 2 0 输出样例#1: 23.348371% 0.000000% 100.00 ...
- UVA 11346 Probability 概率 (连续概率)
题意:给出a和b,表示在直角坐标系上的x=[-a,a] 和 y=[-b,b]的这样一块矩形区域.给出一个数s,问在矩形内随机选择一个点p=(x,y),则(0.0)和p点组成的矩形面积大于s的概率是多少 ...
随机推荐
- [jzoj 6073] 河 解题报告 (DP)
interlinkage: https://jzoj.net/senior/#main/show/6073 description: solution: 考虑一条河$x$被染的效果 显然对于一条河$i ...
- linux编译安装gdb7.10.1
1.下载GDB7.10.1安装包 #wget http://ftp.gnu.org/gnu/gdb/gdb-7.10.1.tar.gz 2.解压 #.tar.gz 3.创建安装目录 #/ #cd /u ...
- 移动端web开发初探之Vuejs的简单实战
这段时间在做的东西,是北邮人论坛APP的注册页.这个注册页是内嵌的网页,因为打算安卓和IOS平台同时使用.因此实际上就是在做移动端的web开发了. 在这过程中遇到了不少有意思的东西. DEMO的git ...
- 【华科考研机试题】最长&最短文本
题目 输入多行字符串,请按照原文本中的顺序输出其中最短和最长的字符串,如果最短和最长的字符串不止一个,请全部输出. 解题思路 1.输入所有字符串(有空格不另算字符串). 2.将char*字符串转换成s ...
- Kafka 分布式消息系统详解
实际上kafka对机器的需求与Hadoop的类似. 原来,对于Linkin这样的互联网企业来说,用户和网站上产生的数据有三种: 需要实时响应的交易数据,用户提交一个表单,输入一段内容,这种数据最后是存 ...
- Windows Phone 编程: 摇一摇 效果
Step 1: 下载摇晃手势开发库 http://create.msdn.com/en-us/edu ... ake_Gesture_LibraryStep 2: 解压后进入 ShakeGesture ...
- eclipse离线安装pydev
首先,下载去http://pydev.org/下载Python的Eclipse插件PyDev. 目前的最新版是PyDev 2.7.1.zip,将压缩文件解压出来.得到features和plugins两 ...
- 科学存储数据格式-HDF5
HDF数据格式 Hierarchical Data Format,可以存储不同类型的图像和数码数据的文件格式,并且可以在不同类型的机器上传输,同时还有统一处理这种文件格式的函数库.大多数普通计算机都支 ...
- springboot-注解讲解
@Configuration:声明我们JdbcConfig是一个配置类 @PropertySource:指定属性文件的路径是:classpath:jdbc.properties 通过@Value为属性 ...
- Asp.net Core 源码-PagedList<T>
using System.Collections.Generic; using System.Linq; using System; using System.Linq.Expressions; us ...