A firm occupies a 10-floors building. After finishing the work day, clerk John has to
carry identical packages between floors. He starts and ends this job on floor 1 and can
carry only one package.
Write a program that finds the minimum number m of the climbed floors and with the
corresponding way of traveling.
Input: The required deliveries are in the text file INPUT.TXT as follows:
|
|||||||||||||||||||||
Output: The deliveries are numbered in order they appear in the file: 1,2,...,k. Output is in the file in the following format:
|
|||||||||||||||||||||
Here is one possible answer
for the given example. The output OUTPUT.TXT consists of: 12 1,6,1 6,7,4 7,6,0 6,10,1 10,8,0 8,9,5 9,4,0 4,3,4 3,4,6 4,3,7 3,2,2 2,1,0 |