poj 1716 Integer Intervals (差分约束)

博客介绍了如何解决POJ 1716题目,该题是一个关于整数区间的差分约束问题。博主给出了输入输出格式的说明,并提供了样例输入和输出。文章重点在于题解部分,表示这个问题相对简单,博主通过跟随他人思路顺利解决。最后,博客中包含了解决问题的代码。
摘要由CSDN通过智能技术生成

Description

An integer interval [a,b], a < b, is a set of all consecutive integers beginning with a and ending with b.
Write a program that: finds the minimal number of elements in a set containing at least two different integers from each interval.

Input

The first line of the input contains the number of intervals n, 1 <= n <= 10000. Each of the following n lines contains two integers a, b separated by a single space, 0 <= a < b <= 10000. They are the beginning and the end of an interval.

Output

Output the minimal number of elements in a set containing at least two different integers from each interval.
Sample Input

4
3 6
2 4
0 2
4 7

Sample Output

4

题解

这题比考试题简单。。。轻松混过!跟着大佬的步伐水水水(不大佬几乎不做水题,只有这几道我能勉强做出来。。)

代码</

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值