mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1865.cpp
This commit is contained in:
parent
420bc16dad
commit
740b1366e6
22
QUSTOJ/1865.cpp
Normal file
22
QUSTOJ/1865.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user