Hermite多项式

Hermite多项式


链接:http://ybt.ssoier.cn:8088/problem_show.php?pid=1165

【题目描述】

用递归的方法求Hermite多项式的值

对给定的x和正整数n,求多项式的值。

【输入】

给定的n和正整数x。

【输出】

多项式的值。

【输入样例】

1 2

【输出样例】

4.00
#include <iostream>
#include<stdio.h>
using namespace std;


double h(int n,int x){
    if(n==0) return 1;
    if(n==1)return 2.0*x;
    return 1.0*(2*x*h(n-1,x)-2*(n-1)*h(n-2,x));
}
int main(){
    
    int x,n;
    cin>>n>>x;
    printf("%.2f",h(n,x));
    
}
原文地址:https://www.cnblogs.com/EdSheeran/p/7327041.html