1999 Canadian Computing Competition, Stage 2
Day 2, Problem 1: Maple Syrup Roundup
An Elmira area maple syrup producer was selected as the winner of this year's CCC (Canadian Confectionary Competition) and the judge wants to place a blue ribbon around the sugar bush. To do this, she finds the most northerly tree (if there is more than one most northerly tree, any one will do) and stands at the position of that tree, facing due East. She then turns to the right until she is facing another tree, and walks to that tree in a straight line, measuring the distance. Once again she turns right until she faces a tree, and walks to it. At each step she chooses the tree that involves turning the least angle to the right, continuing until the starting tree is reached. The total distance travelled is the length of ribbon required. Your task is to calculate this length.
Input
The input to the program will consist of a line containing an integer m followed by m data sets. Each data set consists of a line containing an integer 1 < n ≤ 100, the number of trees in the bush, and this is followed by n lines each with an ordered pair (x,y) of integers which give the location of a tree on the a cartesian grid. You may assume that the y axis points North while the x axis points East.Output
For each test case, the output from the program is the length of ribbon, to 2 decimal places, that can enclose every tree.Sample Input
2 3 -1 1 1 1 1 -1 5 1 0 2 2 2 3 3 1 -1 2
Sample Output
6.83 10.46
All Submissions
Best Solutions
Point Value: 10
Time Limit: 2.00s
Memory Limit: 16M
Added: Apr 19, 2009
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)