//非常标准的递归思路 import java.util.*; public class Main { //在全局判断,不用返回值;后续优化可根据flag做减枝操作 public static boolean flag; public static void main(String[] args) { Scanner sc =new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt(); int[] nums = new int[n]; for (int i = 0; i < n; i++) { nums[i] =...