#include <iostream>
using namespace std;
double f(int,int);
int main()
{
int n,x;
cout<<"please enter n,x";
cin>>n>>x;
cout<<f(n,x)<<endl;
system("pause");
return 0;
}
double f(int n,int x)
{
double s=0;
if(n==0) s=1;
else if(n==1) s=x;
else s=((2*n-1)*x-f(n-1,x)-(n-1)*f(n-2,x))/2;
return s;
}
原文地址:https://www.cnblogs.com/Eternal-kong/p/8422642.html
时间: 2024-11-09 05:48:31