UVa 11346 Probability
来源:互联网 发布:android涂鸦源码 编辑:程序博客网 时间:2024/06/05 01:15
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%
#include <cstdio>#include <cmath>double a, b, s;int main(){int t;scanf("%d", &t);int count = 0;while(count < t){scanf("%lf %lf %lf", &a, &b, &s);double result;if(s == 0)result = 100;else if(a*b <= s)result = 0;else{result = (a*b-s*log(a)-s+s*log(s/b))/(a*b)*100;}printf("%.6f%%\n", result);count++;}return 0;}
题目本身不难,首先明确xy = s为一条双曲线,求得双曲线和矩形相交的上方面积即可。
该面积用定积分来求解,用x积分,被积函数为y, 为b-S/x.
0 0
- UVA 11346 - Probability(概率)
- uva 11346 - Probability(概率)
- uva 11346 - Probability
- Uva 11346 Probability 积分
- UVa 11346 - Probability
- UVa 11346 - Probability
- UVa 11346 Probability
- UVA 11346(p334)----Probability
- uva 11346 Probability
- UVA 11346 - Probability(概率)
- UVA - 11346 Probability (概率)
- Probability UVA
- UVA 11346 Probability (几何概型, 积分)
- 例题10-19 UVA 11346 Probability
- uva 11181 Probability|Given
- Probability Given, UVa 11181
- Uva 11181 - Probability|Given
- UVA 11181 Probability|Given
- PHP数组与对象之间用递归递归转换
- Hadoop集群(第5期)_Hadoop安装配置
- 如何成为优秀的程序员v1.0
- Android ListView 单条刷新方法实践及原理解析
- Hadoop集群(第6期)_WordCount运行详解
- UVa 11346 Probability
- Hadoop集群(第7期)_Eclipse开发环境设置
- POJ -- 1056 IMMEDIATE DECODABILITY (Trie 树)
- 相信我们会创造奇迹
- 《Material Design》设计 - 色彩篇 - UI调色板
- Hadoop集群(第8期)_HDFS初探之旅
- 【麦可网】Cocos2d-X跨平台游戏开发学习笔记---第九课: Cocos2D-X引擎框架4
- 人才招聘网站
- Redis学习手册(Key操作命令)