UVA 11346 - Probability(概率)
2014-07-17 18:37
441 查看
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 t;
double a, b, s;
int main() {
scanf("%d", &t);
while (t--) {
scanf("%lf%lf%lf", &a, &b, &s);
if (s == 0) printf("100.000000%%\n");
else if (s >= a * b) printf("0.000000%%\n");
else printf("%.6lf%%\n", (a * b - s - s * (log(a) - log(s/b))) / (a * b) * 100);
}
return 0;
}
相关文章推荐
- UVA - 11346 Probability (概率)
- UVA 11346 Probability 概率 (连续概率)
- 【积分】【概率】Probability, UVa11346
- uva 11346 - Probability(概率)
- UVa11346 - Probability (连续概率)
- UVA 11346 Probability——连续概率
- UVA 11346 - Probability(概率)
- UVa 11346 Probability (转化+积分+概率)
- UVA - 11346 Probability (概率)
- 【UVA】11181 - Probability|Given(条件概率)
- Probability|Given - UVa 11181 概率dp
- uva 10056 What is the Probability ?(简单概率)
- UVA - 10056 What is the Probability ? 概率UVA - 10056 What is the Probability ?
- UVA - 10056 What is the Probability ?(概率)
- uva 10056 - What is the Probability ?(概率)
- UVA - 11181 Probability|Given (dfs处理条件概率)
- UVA 11346 Probability (几何概型, 积分)
- Uva 11346 Probability 积分
- UVa 11181 - Probability|Given 概率
- uva 11346 - Probability