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

最新文章

  1. golang flag包
  2. Appium常见问题(持续更新)
  3. Microsoft Dynamics CRM 2013 and 2011 Update Rollups and Service Packs
  4. Codeforces Round #378 (Div. 2) D - Kostya the Sculptor
  5. ISE综合后得到的RTL图如何与硬件对应起来,怎么知道每个element的功能
  6. Dynamic SQL--官方文档
  7. Node.js笔记2
  8. Actor::updateMassFromShapes
  9. CTFCrackTools在Windows下显示A Java Exception has occurred的解决方案
  10. 谈谈语音通信中的各种tone
  11. Python——Django-urls.py的作用
  12. extJs学习的资源
  13. java中不同类型的数值占用字节数
  14. 修改windows服务的描述
  15. Unity Shader学习资料
  16. 你不知道的css高级应用三种方法——实现多行省略
  17. MySQL JOIN操作报错问题小解
  18. PC上对限制在微信客户端访问的html页面进行调试
  19. windows上使用wordpress搭建博客
  20. 「HNOI 2015」菜肴制作

热门文章

  1. python 数据的基本类型(字符串)
  2. OpenCascade 边界表示法(BRep)
  3. DDL:对数据库___database___的相关操作,包含数据库备份,导入
  4. css中单位的使用
  5. CI中的url相关函数以及路由设置和伪静态技术
  6. 开发手机APP过程,不同使用场景APP搜索框的样式及区别
  7. 使用Eric构建Caffe应用程序-Baby年龄识别
  8. ubuntu安装-Caffe依赖
  9. location.reload() 和 location.replace()的区别和应用。
  10. Intellij IDEA中Mybatis Mapper自动注入警告的6种解决方案