UVA 11346 - Probability 数学积分
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
UVA 11346 - Probability 数学积分的更多相关文章
- UVa 11346 Probability (转化+积分+概率)
题意:给定a,b,s,在[-a, a]*[-b, b]区域内任取一点p,求以原点(0,0)和p为对角线的长方形面积大于s的概率. 析:应该明白,这个和高中数学的东西差不多,基本就是一个求概率的题,只不 ...
- uva 11346 - Probability(概率)
option=com_onlinejudge&Itemid=8&page=show_problem&problem=2321">题目链接:uva 11346 - ...
- uva 11346 - Probability(可能性)
题目链接:uva 11346 - Probability 题目大意:给定x,y的范围.以及s,问说在该范围内选取一点,和x,y轴形成图形的面积大于s的概率. 解题思路:首先达到方程xy ≥ s.即y ...
- UVA 11346 Probability (几何概型, 积分)
题目链接:option=com_onlinejudge&Itemid=8&page=show_problem&problem=2321">https://uva ...
- UVa 11346 - Probability(几何概型)
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- UVA - 11346 Probability (概率)
Description Probability Time Limit: 1 sec Memory Limit: 16MB Consider rectangular coordinate system ...
- ●UVa 11346 Probability
题链: https://vjudge.net/problem/UVA-11346题解: 连续概率,积分 由于对称性,我们只用考虑第一象限即可. 如果要使得面积大于S,即xy>S, 那么可以选取的 ...
- UVA 11346 Probability
题目描述 PDF 输入输出格式 输入格式: 输出格式: 输入输出样例 输入样例#1: 3 10 5 20 1 1 1 2 2 0 输出样例#1: 23.348371% 0.000000% 100.00 ...
- UVA 11346 Probability 概率 (连续概率)
题意:给出a和b,表示在直角坐标系上的x=[-a,a] 和 y=[-b,b]的这样一块矩形区域.给出一个数s,问在矩形内随机选择一个点p=(x,y),则(0.0)和p点组成的矩形面积大于s的概率是多少 ...
随机推荐
- Surround the Trees[HDU1392]
Surround the Trees Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- BZOJ1060: [ZJOI2007]时态同步(树形dp 贪心)
Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 3285 Solved: 1286[Submit][Status][Discuss] Descript ...
- Android 通用Dialog中设置RecyclerView
通用Dialog public class IOSRecyclerViewDialog{ private Context context; private Dialog dialog; private ...
- ACM_____不再爱你……
不再爱你…… 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 现在有一个圆柱形水杯,里面装满了水,在它的底部有一个小洞,通过一些简单的物理知识我们可以知道: 1.由于重力 ...
- Findbugs分析工具介绍
Findbugs是一个静态分析工具,它检查类或者JAR 文件,将字节码与一组缺陷模式进行对比以发现可能的问题.Findbugs自带检测器,其中有60余种Bad practice,80余种Correct ...
- redis启动出错 Creating Server TCP listening socket 127.0.0.1:6379: bind: No error解决办法
windows下安装Redis第一次启动报错: [2368] 21 Apr 02:57:05.611 # Creating Server TCP listening socket 127.0.0.1: ...
- 2018秋招blibli算法工程师
我给出代码如下:和之前做数塔(dp的入门题目)的思路一致 dp[i][j]为走到坐标(i,j)的最小减速(只有向右走和向上走两种情况) #include<stdio.h> #include ...
- 路飞学城Python-Day113
107-HTTP协议的无状态保存 什么是无状态保存? HTTP无状态请求就是客户端每次发送的请求都是单独的新请求,每一次请求都是独立的,这样的特点在网站上就是服务器登录的时候记录浏览器的信息,建立 ...
- jquery-ui实现拖拽功能
https://www.runoob.com/jqueryui/jqueryui-tutorial.html
- mysql进阶练习
一 . MySQL进阶练习 /*==========================创建班级表=============================*/ CREATE TABLE class ( ...