Create 1865.cpp

This commit is contained in:
Kirigaya Kazuto 2016-10-24 16:48:52 +08:00 committed by GitHub
parent 420bc16dad
commit 740b1366e6

22
QUSTOJ/1865.cpp Normal file
View File

@ -0,0 +1,22 @@
#include <iostream>
using namespace std;
double ans[50];
int vis[50];
double dfunc(int n,int x)
{
if(n==0) return 1;
if(n==1) return x;
if(vis[n]) return ans[n];
vis[n]=1;
return ans[n]=double((2*n-1)*x*dfunc(n-1,x)-(n-1)*dfunc(n-2,x))/n;
}
int main()
{
int a,b;
cin>>a>>b;
cout<<dfunc(a,b);
return 0;
}