4010: [HNOI2015]菜肴制作

Time Limit: 20 Sec  Memory Limit: 256 MB

题目连接

http://www.lydsy.com/JudgeOnline/problem.php?id=4001

Description

Input

输入一个正整数N,代表有根树的结点数

Output

输出这棵树期望的叶子节点数。要求误差小于1e-9

Sample Input

1

Sample Output

1.000000000

HINT

1<=N<=10^9

题意

题解:

一看就是蛋疼结论题,打表打法好,然后看就好了= =

然而证明如下:

http://blog.miskcoo.com/2015/04/bzoj-4001#comment-2070

代码:

//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 200001
#define mod 10007
#define eps 1e-9
int Num;
char CH[];
//const int inf=0x7fffffff; //нчоч╢С
const int inf=0x3f3f3f3f;
/* inline void P(int x)
{
Num=0;if(!x){putchar('0');puts("");return;}
while(x>0)CH[++Num]=x%10,x/=10;
while(Num)putchar(CH[Num--]+48);
puts("");
}
*/
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
inline void P(int x)
{
Num=;if(!x){putchar('');puts("");return;}
while(x>)CH[++Num]=x%,x/=;
while(Num)putchar(CH[Num--]+);
puts("");
}
//************************************************************************************** int main()
{
//freopen("test.txt","r",stdin);
double a;
cin>>a;
printf("%.9f\n",a*(a+)/(*a-));
}

bzoj 4001 [TJOI2015]概率论 数学的更多相关文章

  1. BZOJ 4001 [TJOI2015]概率论 ——找规律

    题目太神了,证明还需要用到生成函数. 鉴于自己太菜,直接抄别人的结果好了. #include <map> #include <cmath> #include <queue ...

  2. 4001: [TJOI2015]概率论

    4001: [TJOI2015]概率论 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 262  Solved: 108[Submit][Status] ...

  3. 概率论 - BZOJ - 4001 TJOI2015

    TJOI2015 Problem's Link ---------------------------------------------------------------------------- ...

  4. 【BZOJ】4001: [TJOI2015]概率论

    题意 求节点数为\(n\)的有根树期望的叶子结点数.(\(n \le 10^9\)) 分析 神题就打表找规律.. 题解 方案数就是卡特兰数,$h_0=1, h_n = \sum_{i=0}^{n-1} ...

  5. 【BZOJ4001】[TJOI2015]概率论(生成函数)

    [BZOJ4001][TJOI2015]概率论(生成函数) 题面 BZOJ 洛谷 题解 这题好仙啊.... 设\(g_n\)表示\(n\)个点的二叉树个数,\(f_n\)表示\(n\)个点的二叉树的叶 ...

  6. [TJOI2015]概率论

    [TJOI2015]概率论 史上最短黑题 看起来一脸懵逼,没有取模,1e-9 根据期望定义,发现 分母是一个卡特兰数,,,,不能直接算 所以考虑怎么消掉一些东西 gn表示n个点的叶子个数和,fn表示n ...

  7. bzoj4001: [TJOI2015]概率论

    题目链接 bzoj4001: [TJOI2015]概率论 题解 生成函数+求导 设\(g(n)\)表示有\(n\)个节点的二叉树的个数,\(g(0) = 1\) 设\(f(x)\)表示\(n\)个节点 ...

  8. 【BZOJ4001】【Luogu P3978】 [TJOI2015]概率论

    题目描述: Description: Input 输入一个正整数N,代表有根树的结点数 Output 输出这棵树期望的叶子节点数.要求误差小于1e-9 Sample Input 1 Sample Ou ...

  9. BZOJ 4000: [TJOI2015]棋盘( 状压dp + 矩阵快速幂 )

    状压dp, 然后转移都是一样的, 矩阵乘法+快速幂就行啦. O(logN*2^(3m)) ------------------------------------------------------- ...

随机推荐

  1. Bootstrap文件上传组件:bootstrap fileinput

    为了上传预览pdf与图片特用此插件. 源码以及API地址: bootstrap-fileinput源码:https://github.com/kartik-v/bootstrap-fileinput ...

  2. oracle imp dmp命令

    vi par.txt userid=system/oracle tables=(user.table,...) query="where org_no like 32%" file ...

  3. 工具===激活xmind 8

      [下载jar包]: https://stormxing.oss-cn-beijing.aliyuncs.com/files/XMindCrack.jar   方法: 打开xmind 8 安装目录的 ...

  4. NEERC2014

    NEERC2014 A - Alter Board 题目描述:给出一个\(n \times m\)的国际象棋棋盘,每次选定一个矩形,使得矩形中的每个格子的颜色翻转,求出最少次数的方案使得最终棋盘只有一 ...

  5. 数学中的Sin和Cos是什么意思?(转)

    数学中的Sin和Cos是什么意思? 作者:admin 分类:生活随笔 发表于 2012年03月21日 16:48 问:数学中的Sin和Cos是什么意思? 答:sin, cos, tan 都是三角函数, ...

  6. 安全控制 iptables

    转自:http://www.opsers.org/linux-home/videos/chapter-netfilter-iptables-raiders.html 内容简介防火墙的概述iptable ...

  7. 数据分析python应用到的ggplot(二)

    还是优达学院的第七课 数据:https://s3.amazonaws.com/content.udacity-data.com/courses/ud359/hr_by_team_year_sf_la. ...

  8. Java Character & String & Scanner类

    Character类 Character 类用于对单个字符进行操作. Character 类在对象中包装一个基本类型 char 的值 char用法: char ch = 'a'; // Unicode ...

  9. LINUX下PHP编译添加相应的动态扩展模块so(不需要重新编译PHP,以openssl.so为例)

    本文转自:原文链接  http://www.cnblogs.com/doseoer/p/4367536.html 网上我看到有很多相关的文章都是简述这个问题的,但毕竟因为LINUX版本众多,很多LIU ...

  10. **CodeIgniter通过hook的方式实现简单的权限控制

    根据自己的实际情况,需要两个文件,一个是权限控制类,Acl,另外一个是权限配置的文件acl.php放在了config这个目录下. Acl这个类放在了application/hook/acl.php.通 ...