题目链接:uva 11346 - Probability

题目大意:给定x,y的范围。以及s,问说在该范围内选取一点,和x,y轴形成图形的面积大于s的概率。

解题思路:首先达到方程xy ≥ s。即y = s / x。

S2的面积用积分计算,y = s / x的原函数为lnx

所以S2=s∗(ln(a)−ln(x))

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm> using namespace std; int main () {
int cas;
double a, b, s;
scanf("%d", &cas); while (cas--) {
scanf("%lf%lf%lf", &a, &b, &s);
double r = min(s / b, a);
double ans = r * b + log(a) * s; if (fabs(s) > 1e-9)
ans = ans - log(r) * s; double p = 1 - ans / (a * b);
printf("%.6lf%c\n", fabs(p * 100), '%');
}
return 0;
}

uva 11346 - Probability(可能性)的更多相关文章

  1. uva 11346 - Probability(概率)

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

  2. UVA - 11346 Probability (概率)

    Description Probability Time Limit: 1 sec  Memory Limit: 16MB Consider rectangular coordinate system ...

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

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

  4. UVA 11346 - Probability 数学积分

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

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

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

  6. ●UVa 11346 Probability

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

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

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

  8. UVA 11346 Probability

    题目描述 PDF 输入输出格式 输入格式: 输出格式: 输入输出样例 输入样例#1: 3 10 5 20 1 1 1 2 2 0 输出样例#1: 23.348371% 0.000000% 100.00 ...

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

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

随机推荐

  1. [Now] Update an application hosted with Zeit’s Now

    Because now deploys are immutable, you can’t push changes to a running instance - you just push a ne ...

  2. android的edittext设置输入限制,只能输入数字

    EditText的属性里面已经封装好了相关的设置,上一篇文章里面也提到了,不熟悉的可以去查看上一篇EditText属性大全,这里着重讲输入限制的属性: android:digits="123 ...

  3. jquery或js 获取url参数

    <script type="text/javascript"> function getUrlParam(name) { var reg = new RegExp(&q ...

  4. jquery中的this与$(this)的区别总结(this:html元素)($(this):JQuery对象)

    jquery中的this与$(this)的区别总结(this:html元素)($(this):JQuery对象) 一.总结 1.this所指的是html 元素,有html的属性,可用 this.属性  ...

  5. PHP移动互联网开发笔记(5)——基础函数库

    一.数学函数库 ● floor 舍一取整(向下取整) float floor (float $value); <?php echo(floor(0.60)."<br>&qu ...

  6. 【u022】车的放置

    [问题描述] [题解] 先考虑一个最简单的情况.如一个n*n的棋盘.然后要放k个车. 我们可以先选出k行即C(n,k); 然后在列上对这k个棋子进行一次全排列即A(n,k); 比如k = 4;N=5 ...

  7. Git Push问题remote: hooks/update:10 undefined method &#39;require_relative&#39; for main:Object(NomethodError)

    今天在提交代码时遇到到了一个非常蛋疼的问题,remote: hooks/update:10 undefined method 'require_relative' for main:Object(No ...

  8. [Ramda] Convert Object Methods into Composable Functions with Ramda

    In this lesson, we'll look at how we can use Ramda's invoker and constructNfunctions to take methods ...

  9. html+css+js实现狼吃羊小游戏

    html+css+js实现狼吃羊小游戏 一.总结 一句话总结:给动的元素下标记,这里表现为将要活动的标签动态增加class,这是一种很好的思想. 1.如何实现棋子走动的时候简单精确定位? 用重构坐标系 ...

  10. 前端调用百度API

    <!DOCTYPE html> <html> <head>         <meta charset="UTF-8">       ...