#Lutece0566. Logs
Logs
Migrated from Lutece 566 Logs
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
The server of CDOJ logs all the submissions submitted by users. There are four types of logs: submissions of
- every day ( day, day, ......),
- every days ( to days, to days, ……),
- every days ( to days, to days, ……),
- every days( to days, to days, ……).
We name a log as an interval , in which s and t represent the time of the first submission and the last submission. For each type, every submission would be recorded only once. For example, in the second type of logs, submissions on the day would be recorded in log . Logs such as , do not exist.
Now Yangsir wants to know the information about all the submissions between day and day (inclusive). He can take several logs out one by one. Assume that Yangsir has a box
to put submissions. When he takes a log out, all the submission in that log would be put into the box
. However, if some submissions have already been in the box
, both submissions would disappear because of some strange reason. The final submissions in the box
are what Yangsir gets.
For example, Yangsir would get submissions between day and day when he takes and out. If he takes , , , out one by one, what he gets are submissions between day and day .
How many logs Yangsir should take out at least if he needs all the submissions between day and day ?
Input
There are multiple test cases. The first line of the input will be an integer () indicating the number of test cases.
For each test case there are two integers and () in a single line.
Output
For each test case, print Case #t:
first, in which is the number of the test case starting from . Then output the minimum number of logs needed.
Samples
3
42 42
21 28
180 203
Case #1: 1
Case #2: 2
Case #3: 3
Note
For the third sample, only logs are needed: , , . Combining log with , we get . Log could remove all submission after Day .
Resources
10th UESTC Programming Contest Preliminary