HDU 4808 Drunk(数学)
思路:这个题居然高数老师说过...它的公式其实就是x*f(x)的积分/f(x)的积分,f(x)=(r^2-x^2)^(n-1)/2,然后推推就出来了
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2*1e5+7;
#define LL long long
#define pi acos(-1.0)
double si[maxn];void init()
{si[0]=1;si[1]=1;for(int i = 2;i<maxn;i++)si[i]=si[i-2]*(i-1)/i;
}
int main()
{init();int r,n;while(scanf("%d%d",&n,&r)!=EOF){if(n&1)printf("%.10lf\n",1.0*r/(n+1)/si[n]);elseprintf("%.10lf\n",1.0*r/(n+1)/(si[n]*pi/2));}
}
Description
Assume the expectation of his coordinate after his first step is (y 1, y 2, ... , y n). He wants to know the minimum y i .
Input
Each test case, only one line contains two integers N and R, representing the dimension of the space and the length limit of each step.(1 <= n <= 2 * 10 5, R <= 10 5).
Output
Your answer is considered correct if the difference between your answer and the correct one is less than 10 -6.
Sample Input
2 1
Sample Output
0.4244131816
HDU 4808 Drunk(数学)相关推荐
- HDU 4808 Drunk
题意:给定一个n维欧几里德空间中的一个n维向量(x1,x2,..,xn),xi>=0,sigma(xi^2)<=R^2.问xi最小值的期望. 解法:注意到空间球体的强对称性,即求x方向上的 ...
- HDU 4808 数学 期望 积分
HDU 4808 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4808 题意: 在一个多维空间中,一个人从原点迈出一步,这步最多R那么长.问其中一维 ...
- HDU 5914 Triangle 数学找规律
Triangle 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5914 Description Mr. Frog has n sticks, who ...
- Hdu 5339 Untitled (数学思维)
题意:给一个数a和n个数b1,b2,...,bn. 从n个数中选择一些数重新排列成c1,c2,...,cm使得a%c1%c2%...%cm=0. 如果能选出则输出最少需要几个数,否则输出-1. 分析: ...
- HDU 5976 Detachment(数学+结论)
原题地址:http://acm.hdu.edu.cn/showproblem.php?pid=5976 参考博客:https://blog.csdn.net/qq_34374664/article/d ...
- hdu 1593(数学)
转载标记处:http://www.xuebuyuan.com/2131627.html 往相反的方面跑,但是,最理想的初始位置并不是圆点和圆上的某一点,应该还有更理想的初始逃跑状态.这里有一点需要注意 ...
- Circle HDU - 6550 (数学)
在半径为 1 的圆上有 n 个点,它们也是圆的 n 等分点,将每个相邻的 n 等分点相连,组成了一个正 n边形,现在你可以在圆上再增加一个点,使得新的 n + 1 边形的面积最大,请输出最大面积. I ...
- Function HDU - 6546 (数学,贪心)
wls 有 n 个二次函数 Fi(x) = aix2 + bix + ci (1 ≤ i ≤ n). 现在他想在∑ni=1xi = m 且 x 为正整数的条件下求∑ni=1Fi(xi)的最小值. 请求 ...
- B - Cube HDU - 1220 (数学计数)
题意:一个边长为N的正方体,切割成N*N*N个单位正方体,问有多少对正方体之间有0个,2个公共点. 思路:因为正方体之间出现公共点的情况有0,2,4. 那么直接正面求,肯定不好求,那么先求出有4个公共 ...
最新文章
- Learn Jenkins the hard way (0) - Jenkins的罪与罚
- Nodejs进阶:express+session实现简易身份认证
- CTFshow php特性 web114
- Html 教程 (4) <head>
- nginx php fpm sock_nginx使用sock方式调用php-fpm
- CSS布局奇淫技巧之--各种居中
- Python学习秘籍 这些窍门就连老司机都不一定知道 值得学习
- 多项式的链式存储方案
- 疑似OPPO Reno6系列新机通过工信部认证:配备6.43英寸屏 机身仅7.9mm
- AES加密例子(python和php版本)
- Ubuntu开启Mongodb 外网访问
- 铁芯用matlab怎么仿真,Simulink的BLDC建模与仿真
- 2345浏览器网址_清理流氓网站2345.com劫持浏览器
- Spring AOP失效之谜
- 获取 app 签名的方式汇总
- led伏安特性实验误差分析_大学物理实验伏安特性曲线的误差分析以及小结要怎么写,谢谢^ω^...
- python读取文件并替换字段_python 读取文件并替换字段的实例
- html创建站点文件夹,构建及访问Web站点
- linux格式化fat的命令,Linux磁盘格式化命令详解
- xv6进程切换-swtch函数