n <= 0 : 1
Hn(x) = n =
1 : 2x
n >= 2 : 2xHn-1(x)
- 2(n -1)Hn-2(x)
#include<stdio.h> int hermite(int n, int x) { if(n <= 0) return 1; else if(1 == n) return 2*x; else return 2 * x * hermite(n-1, x) - 2 * (n-1) * hermite(n-2, x); } int main() { int h = hermite(1,2); printf("%d\n",h); return 0; }
时间: 2024-11-13 23:17:04