BZOJ 4001[TJOI2015]概率论
来源:互联网 发布:建筑工程优化设计方案 编辑:程序博客网 时间:2024/05/17 22:56
4001: [TJOI2015]概率论
Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 583 Solved: 294
[Submit][Status][Discuss]
Description
Input
输入一个正整数N,代表有根树的结点数
Output
输出这棵树期望的叶子节点数。要求误差小于1e-9
Sample Input
1
Sample Output
1.000000000
HINT
1<=N<=10^9
解题思路:
手动推了前5个,发现规律 ans = n * (n + 1) / 2 / (2 * n - 1);
#include <iostream>#include <cstring>#include <cstdlib>#include <cstdio>#include <cmath>#include <algorithm>#define LL long long using namespace std;const int MAXN = 1000 + 10;double N;int main(){ scanf("%lf", &N); double ans = (N * (N + 1)) / 2.0 / (2.0 * N - 1.0); printf("%.9lf\n", ans); return 0;}
0 0
- BZOJ 4001[TJOI2015]概率论
- bzoj 4001: [TJOI2015]概率论(找规律)
- [期望 生成函数 卷积 导数] BZOJ 4001 [TJOI2015]概率论
- 4001: [TJOI2015]概率论
- 【TJOI2015】【BZOJ4001】概率论
- bzoj 4001 概率论
- 【MATH】TJOI2015 BZOJ4001 LGP3978 概率论
- BZOJ 3996: [TJOI2015]线性代数
- bzoj 3998: [TJOI2015]弦论
- bzoj 3998 [TJOI2015]弦论
- [BZOJ 3996][TJOI2015]线性代数
- bzoj 4000: [TJOI2015]棋盘
- BZOJ 3998 [TJOI2015]弦论
- BZOJ 3996: [TJOI2015]线性代数
- bzoj 3998 [TJOI2015]弦论
- BZOJ 3997: [TJOI2015]组合数学
- BZOJ 3997: [TJOI2015]组合数学
- 【BZOJ 3997】: [TJOI2015]组合数学
- MPLS调试笔记之FP用法
- Nitrate XML-RPC Service API
- Android CheckBox 图片设置开关
- 灰度线性变换
- Vim多窗口编辑
- BZOJ 4001[TJOI2015]概率论
- Android签名打包出现Export aborted because fatal lint errors were found的解决
- SVG可伸缩矢量图形学习笔记
- MyEclipse 生成javaDoc文档
- Android HTTP Content-type( Mime-Type)对照表
- JavaScript实现大整数阶乘的解决方案
- DOM4J
- Serial,Parallel,CMS,G1四大GC收集器特点小结
- alloc与allocWithZone的用法区别