On Sun, Jun 23, 2002 at 05:21:49PM +0200, Steffen Mueller wrote:
> Don't know about the list, but this is the shortest I could go within five
> minutes (44). I bet many of you can find lower scores in less time. :)
> 
> $n=<>;print+(sort{abs$n-$a<=>abs$n-$b}<>)[0]

Here's a lower score (38), but definitely not in less time.  I've spent too
much time on this already.  To keep my pride, I won't tell you how long I've
been concentrating at it :)

-p $n?$a[1e5-abs$_-$n]:$n=$_}{$_=pop@a

Using (-ugene's famous }{ trick with the -p flag and taking advantage of
autovivification of array elements.

-- Mike

-- 
Michael W. Thelen
eval unpack 
u,'M*"1C/2<P,BDN-"`U+C`A(RLG*3U^>2\A+48O82UZ+SME=F%L*"1C+B(G=2HGM+"<Z,D<U4SU<(B%!.T9=5#HF-5(H)2%%/$907$`Z)B5#.E8U4BM@2&`G+EPD$+R(I.P``'

Reply via email to