AlgorithmOJ
Problem
Local Problems
All Problems
Problem Category
Status
Contest
Standard Contests
Replay Contests
Virtual Contests
Ranklist
More...
News
About
F.A.Q
Recent Contests
Coming Soon...
Login
Register
2026-04-27 15:37:40
看电视
Time Limit:
1000ms
Memory Limit:
32768KB
64-bit integer IO format:
%lld
Java class name:
Main
Prev
Submit
Status
Statistics
Next
Font Size:
Description
暑假到了,小明终于可以开心的看电视了。但是小明喜欢的节目太多了,他希望尽量多的看到完整的节目。
现在他把他喜欢的电视节目的转播时间表给你,你能帮他合理安排吗?
Input
输入包含多组测试数据。每组输入的第一行是一个整数n(n<=100),表示小明喜欢的节目的总数。
接下来n行,每行输入两个整数si和ei(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
Author
Admin
Language:
C++ (GCC 5.4.0)
C++11 (GCC 5.4.0)
C++14 (GCC 6.3.0)
C (GCC 5.4.0)
Java (OpenJDK 1.8.0)
Pascal (FPC 3.0.0)
Python2 (2.7.12)
Python3 (3.5.2)
Python3 (3.8.2)
C# (Mono 4.2.1)
Fortran
Perl
Ruby
Ada
SML
Visual C++
Visual C
CLang
CLang++
Theme:
Monokai
Solarized Light
Material
Share Code?
Yes
No
×
Login
Username:
Password:
Cookie:
Never
One Day
One Week
One Month
One Year
×
Register
Username:
Password:
Repeat Password:
Nickname:
School:
Email:
×
News Title
by