//好不容易 做出来一题,第二题始终20%。回家喂牛哦 public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String str = scanner.nextLine(); List<Character> list = new ArrayList<>(); for (int i = 0; i < str.length(); i++) { list.add(str.charAt(i)); } int index = 1; int result = 1; while(!list.isEmpty()){ if (list.get(index)==')'){ result *= index; list.remove(index); list.remove(index-1); index = index-1; }else{ index++; } } System.out.println(result); }