Canadian Computing Competition: 1999 Stage 2, Day 2, Problem 3
The fast food chain, McBurger, has recently consolidated all activities to restaurants along the Trans Canada Highway. (Following the completion of fixed links joining Newfoundland and Vancouver Island to the mainland.) They have also decided to build several warehouses along the highway, each located at a restaurant and supplying those restaurants nearby. Naturally, these warehouses should be placed so as to minimize the distance between the warehouses and the restaurants they service. Your task is to write a program that determines the optimal positions for the warehouses.
To make the problem more precise, chairman McBoss has issued the following specification: You are given the positions of
Input Specification
The input file contains several test data sets. Each data set begins with the two integers 0
will follow the last data set. Each integer will be on a separate line of input.
Output Specification
For each input data set, output three lines. The first line must contain
Sample Input
6
3
5
6
12
19
20
27
0
Sample Output
6 20 27
6
Comments