We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c2f51f9 commit 7abda62Copy full SHA for 7abda62
经典项目/计算厄密多项式.c
@@ -1 +1,30 @@
1
-#
+#include <stdio.h>
2
+
3
+/**
4
+ * 计算 Hermite polynomial 的值
5
+ *
6
+ * 输入:
7
+ * n, x:用于标识值
8
9
+ * 输出:
10
+ * polynomial的值(返回值)
11
+**/
12
13
+int hermite( int n, int x )
14
+{
15
+ // 处理不需要递归的特殊情况。
16
+ if( n <= 0 )
17
+ return 1;
18
+ if( n == 1 )
19
+ return 2 * x;
20
21
+ // 否则,递归地计算结果值。
22
+ return 2 * x * hermite( n - l, x ) - 2 * ( n - 1 ) * hermite ( n - 2, x );
23
+}
24
25
+int main()
26
27
+ printf("%d\n", hermite(3,2));
28
29
+ return 0;
30
0 commit comments