第一题: public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for(int i = 0; i<n; i++) { arr[i] = sc.nextInt(); } System.out.println(solve(arr.length)); } public static int solve(int index) { if(index == 1) { return 0; } else if(index == 2) { return 1; } else { for(int i = index; i > 0; i--) { return (i-1)*(solve(i-1)+solve(i-2)); } } return -1; } }