BZOJ4001 [TJOI2015]概率论 【生成函数】

题目链接

BZOJ4001

题解

Miskcoo
太神了,orz

#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<map>
#define Redge(u) for (int k = h[u],to; k; k = ed[k].nxt)
#define REP(i,n) for (int i = 1; i <= (n); i++)
#define mp(a,b) make_pair<int,int>(a,b)
#define cls(s) memset(s,0,sizeof(s))
#define cp pair<int,int>
#define LL long long int
using namespace std;
const int maxn = 100005,maxm = 100005,INF = 1000000000;
inline int read(){
	int out = 0,flag = 1; char c = getchar();
	while (c < 48 || c > 57){if (c == '-') flag = -1; c = getchar();}
	while (c >= 48 && c <= 57){out = (out << 3) + (out << 1) + c - 48; c = getchar();}
	return out * flag;
}
double n;
int main(){
	cin >> n;
	printf("%.9lf",n * (n + 1) / (2 * (2 * n - 1)));
	return 0;
}

posted @ 2018-05-12 08:16  Mychael  阅读(223)  评论(0编辑  收藏  举报