public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); Set<Integer> set = new HashSet<>(); while (scanner.hasNextLine()) { String s = scanner.nextLine(); String[] s1 = s.split(" "); Integer a = Integer.valueOf(s1[0]); Integer b = Integer.valueOf(s1[1]); for (int i = a+1; i <= b; i++) { set.add(i); } } System.out.println(set.size()); } }

相关推荐

04-17 10:16
门头沟学院 Java
小浪_coder:24届很难找了,马上25的都毕业了还有很多没找到的
点赞 评论 收藏
分享
牛客网
牛客企业服务