F |
Racing
Car Computer Input: Standard Input Output: Standard Output |
The racing cars of today are
equipped with so many sophisticated equipment. Introduction of a new visual
transducer which is interfaced with the on-board computer can tell you on the
fly how many cars are ahead of you while how many are trailing. There are N cars
on a racing track. Each has an on-board computer with the new feature. During
the race, every single car's computer keeps displaying two integers, a (The
number of cars in front of him) & b (The number of cars behind him)
for a particular moment. It is possible that at some time, some of the cars are
racing side by side i.e. they are exactly at the same location. A car will not
consider any other car at the same location to be a leading or trailing car.
Now, it is suspected that some of the new transducers are not working properly inside such high speed vehicles. The report with all computers' data generated at a particular timestamp is reported to you. You are to determine the minimum number of cars that have faulty data.
Each test case begins with an
integer N (1<=N<=1000), the number of cars on a track . The
next N lines each has two integers - a & b (0<=a,b<=1500) for
a particular car.
The last test case is followed by
a line with a single 0 indicating the end of input.
For each test case, print a line
in the format, “Case X: Y”, where X is the case number & Y
is the minimum number of cars that must have faulty data according to the
report.
4 2 2 0 0 0 2 3 1 1 1 1 0 |
Case 1: 3 Case 2: 1 |
Problemsetter: Mohammad Mahmudur Rahman
Special Thanks: Md. Arifuzzman Arif