This summer without AC / HDU - 2037

"This summer without AC?"
"Yes." "What
are you doing?"
"Yeah watching the World Cup, stupid!"
"@ # $% ^ & *% ..."

Indeed, the World Cup came to a fan festival also estimated that many ACMer will put aside the computer, toward the television.
As fans, we want to see as much of the full game, of course, as a new era of good young people, you must also look at some other programs, such as news network (Never forget that concerned about national affairs), is 6 + 7, Super girls, and Wang Xiaoya of "happy dictionary" and so on, assuming you already know you like to watch the broadcast schedule of all TV programs, you'll arrange it? (Goal is to see as much of the full program)

Input

输入数据包含多个测试实例,每个测试实例的第一行只有一个整数n(n<=100),表示你喜欢看的节目的总数,然后是n行数据,每行包括两个数据Ti_s,Ti_e (1<=i<=n),分别表示第i个节目的开始和结束时间,为了简化问题,每个时间都用一个正整数表示。n=0表示输入结束,不做处理。 

Output

对于每个测试实例,输出能完整看到的电视节目的个数,每个测试实例的输出占一行。

Sample Input

12
1 3
3 4
0 7
3 8
15 19
15 20
10 15
8 18
6 12
5 10
4 14
2 9
0

Sample Output

5

The meaning of problems

多组测试数据, 给你n个区间,求最多能选择多少个不相交的区间
n <= 100
端点处可以重合

answer

Code

Guess you like

Origin www.cnblogs.com/Little-Turtle--QJY/p/12389430.html