We had another minigolf on ircnet #perl on which you may want to
try your teeth.

You get on stdin one integer per line. The first integer is the target.
Find in the rest the number closest to the target and print it to stdout
followed by a newline, nothing should go to stderr. No values will be
equally close to the target. Each line matches /^[1-9]\d{0,3}\n\z/.
Input will be at least two lines. 

example input: 

8
12
6
13
5
  
here 8 is the target number, 6 is closest (distance two),
so the output should be: 

6

(standard rules apply. perl 5.6.1, memory <= 2**32 etc.)

It was won by Rick Klement and Ton Hospel with a score of 35.
However, in the post-mortem mtv (who else) found a 32. 

What can this list do ? Can you find 35 ? 32 ? even lower ?

Reply via email to