//好不容易 做出来一题,第二题始终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); }
点赞 评论

相关推荐

牛客10001:G了+1,被前端/客户端给捞起来了,不太想面
投递美团等公司6个岗位 美团求职进展汇总
点赞 评论 收藏
分享
牛客网
牛客企业服务