UVA - 11346 Probability (概率)
来源:互联网 发布:多宝视训练软件多少钱 编辑:程序博客网 时间:2024/05/16 18:14
Description
G - 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:
310 5 201 1 12 2 0
SAMPLE OUTPUT:
23.348371%0.000000%100.000000%题意:给定a,b,s要求在[-a,a]选定x,在[-b,b]选定y,使得(0, 0)和(x, y)组成的矩形面积大于s的概率思路:转换成x*y > s的图形面积,利用求导函数求面积的方式计算,y=s/x的导函数是y=s*lnx
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>using namespace std;int main() {int t;double a, b, s;scanf("%d", &t);while (t--) {scanf("%lf%lf%lf", &a, &b, &s);if (a * b <= s) {puts("0.000000%");continue;}if (s == 0) {puts("100.000000%");continue;}printf("%lf%%\n", 100 - (s + s * (log(a) - log(s / b))) / a / b * 100);}return 0;}
1 0
- UVA 11346 - Probability(概率)
- UVA - 11346 Probability (概率)
- UVA 11346 - Probability(概率)
- uva 11346 - Probability(概率)
- uva 11181 - Probability|Given(概率)
- UVA 11181 - Probability|Given (概率DFS)
- 【UVA】11181 - Probability|Given(条件概率)
- Uva 11181 Probability|Given(概率dp)
- UVA-11181 Probability|Given(概率)
- UVa 11181 - Probability|Given 概率
- UVA 11181 Probability|Given 概率
- UVA.11181 Probability|Given (概率)
- uva 10056 - What is the Probability ?(概率)
- UVA 10056 - What is the Probability ?(概率)
- UVA - 10056 What is the Probability ?(概率)
- UVa 11181 - Probability|Given (条件概率)
- What is the Probability - UVa 10056 概率
- Probability|Given - UVa 11181 概率dp
- linux虚拟内存管理
- voj1485 传球游戏 dp
- leetcode generate parentheses
- poj3984
- Android 性能测试
- UVA - 11346 Probability (概率)
- phoneGap3.0安装步骤(以windows下的android环境为例):
- 排序树 变成双向链表2
- HTTP POST GET详解
- linux-arm中断系统之GIC
- voj1431 守望者的逃离 贪心
- HDOJ 题目2588 GCD(欧拉函数)
- 北京四季青租房-----隐藏在中介(安信嘉和)中的黑二房东--韩亮
- Android 点击ListView(或GridView)的一个item,使其里面textview变色,点击另一个这个恢复原来颜色