| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 262 | 186 | 170 | 71.429% |
Going on a road trip is an adventure for Dr. Orooji and his family. Obviously he has to stop to refuel the car, but he also stops whenever his kids want to eat. Dr. O needs to figure out the number of stops before going on the trip so he is mentally prepared.
Find the total number of stops for Dr. O’s trip, given:
Assume that the car’s gas tank is full at the beginning of the trip and the kids are full as well. If the destination happens to be the time to refuel (or eat), do not count it as a stop. Also, if a particular mileage happens to be both refueling time and eating time, count it as one stop and not two stops.
Note that if a particular mileage happens to be refueling time only, kids won’t eat at that stop. Similarly, if a particular mileage happens to be eating time only, the car is not refueled at that stop.
The first input line contains a positive integer, t, indicating the number of trips to check. The trips are on the following t input lines, one trip per line. Each trip provides three integers (each between 1 and 1000, inclusive); these are the three values specified in order above.
For each trip, output the three input values. Then, on the next output line, print the number of stops for the trip.
3 100 30 40 10 5 1 20 3 4
100 30 40 5 10 5 1 9 20 3 4 9