
ZOJ Problem Set  1120
A chairlift is used to transport skiers (or summer sightseers) up the mountain. Figure 1 shows the components of a chairlift, viewed from the air above the chairlift:
A closedloop steel cable is in continuous motion around two rotating
wheels (one at the bottom, one at the top of the mountain). The chairs are numbered in the order in which they appear at the loading station when the lift is first activated in the morning. That is, they are numbered starting at 1, increasing sequentially in a direction opposite to the direction of motion. Figure 4 is a reproduction of Figure 1, showing chair numbers for the case N = 18. (Remember that the figure is just a ��snapshot��, the chairs are in continuous motion.) Now that you are familiar with the chairlift, it is time to state the problem. Two friends, whom we shall call Bob and Alice, are out for a day of skiing. They are just riding up in chair 56 and know that the lift has 126 chairs. They also know that the ride from the loading station to the unloading station takes exactly 225.0 seconds. Bob asks Alice: ��How much longer will the ride take?�� Alice doesn��t look at her watch. Instead, she waits until their chair meets a downward bound empty chair, notes that the number of that chair is 71, and replies: ��We have 198.9 more seconds to go.�� (An upward bound chair and a downward bound chair ��meet�� when they are exactly opposite each other (i.e., both chairs are equidistant from the top of the mountain). At the instant shown in Figure 4, no two chairs meet, but very soon thereafter, chairs 6 and 7, as well as chairs 5 and 8, etc., would meet.) Your program will carry out Alice��s computations. Sample Input 126 225.0 56 71 31 120 100 53 Sample Output Program 1 by team X N = 126, T = 225.0 Chair 56 meets chair 71, remaining time = 198.9 Chair 31 meets chair 120, remaining time = 65.7 Chair 100 meets chair 53, remaining time = 83.7 End of program 1 by team X The first line of the input file will contain N, followed by T.
The constraints on N were previously stated. T (the time it takes to ride from
the loading station to the unloading station) is a floating point number, measured
in seconds, 200.0 <= T <= 999.9. The first line will be followed by one
or more additional lines of input. On each of these additional lines, there
will be exactly two integer values in the range 1..N, representing two distinct
chairs. The first of these chairs is the upward bound chair in which Bob and
Alice are riding. The second chair is the downward bound chair they meet when
Alice announces the remaining time. N = 126, T = 225.0 1234567890123456789012345678901234567890123456789 Chair 56 meets chair 71, remaining time = 198.9 Note in particular, that Source: Rocky Mountain 2000 