厄密多项式函数

<span lang="EN-US" style="font-family: 'Times New Roman','serif'; font-size: 10.5pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA;"></span><pre class="cpp" name="code">/*厄密多项式函数
  函数定义如下:    
                    
                   n <=0  ; 1
   fun(n,x)=    n = 1  ; 2*x
                   n > 1  ; 2*fun(n-1,x)-2*(n-1)*fun(n-2,x)
*/

#include<stdio.h>

int hermite(int n, int x)
{
  
   if(n <= 0)
   {
	 return 1;
   }
   
   else if(1 == n)
   {
     return  2*n;
   }
   
   else 
   {
     return  2 * hermite(n-1,x) - 2 * (n-1) * hermite(n-2,x);
   }
 
   
}

int main()
{   
	int nn,xx;
	
	scanf("%d,%d",&nn,&xx);
     
	printf("%d\n",hermite( nn,xx ));

    return 0;
}

 
 

 

你可能感兴趣的:(厄密多项式函数)