第一题 Scanner sc = new Scanner(System.in); ArrayList<Integer> list = new ArrayList<Integer>(); while (sc.hasNextInt()) {     list.add(sc.nextInt()); } 第二题 Scanner sc = new Scanner(System.in); ArrayList<Integer> list = new ArrayList<Integer>(); string s = sc.nextLine(); int k = sc.nextInt(); String[] numString = in.nextLine().split(" "); for (String t:numString) {     list.add(Integer.parseInt(t)); }
点赞 评论

相关推荐

ResourceUtilization:四六级不愧是大学最有用的证之一
点赞 评论 收藏
分享
谁知道呢_:你好,我是炮灰n+1号
点赞 评论 收藏
分享
牛客网
牛客企业服务