题解 | #牛牛的Hermite多项式#
牛牛的Hermite多项式
https://www.nowcoder.com/practice/0c58f8e5673a406cb0e2f5ccf2c671d4
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static int result(int n, int x) { //在函数中将题目的要求写出来即可 if (n == 0) { return 1; } else if (n == 1) { return 2 * n; } else { return 2 * x * result((n - 1), x) - 2 * (n - 1) * result(n - 2, x); } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x = sc.nextInt(); System.out.println(result(n, x)); } }