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()); } }

相关推荐

狸猫换offer:神通广大的互联网
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务