develooper Front page | | Postings from July 2002

Re: more minigolf

Thread Previous | Thread Next
Phil Carmody
July 11, 2002 10:37
Re: more minigolf
Message ID:
I can't believe people manged to work out how to use regexps to solve
this - they looked to complicated for me , so I just went with the
simple recurrence! My 2 entries inserted in numerical order. Note -
the zero-based one did end up shorter than my one-based one, which
counters what I first thought!


En op 11 juli 2002 sprak Chris Dolan:

Add your solutions to this list

---- Zero-based ----

44 FatPhil (non-regex)
-l print$t=1,map$".($t*=$x--/$_),1..($x=pop)

45 Chris Dolan
-l s/\d+/$&+$'/eg,s/^/1 /for($_=1)x+pop;print

49 Chris Dolan (non-regex)

81 Chris Dolan (factorials)

34 Eugene van der Pijll (rejected...)
@a^+=(!$_,@a)for 0..pop;print"@a

---- One-based ----

46 FatPhil (non-regex)
-l print$t=1,map$".($t*=--$x/$_),1..~-($x=pop)

48  Jasper McCrea
-l s/\S+/$&+$'/eg&s/^/1 /for($_)x pop;chop;print

49 Chris Dolan
-l s/\d+/$&+$'/eg,s/^/1 /for($_=1)x(-1+pop);print
49 Chris Dolan

36 Eugene van der Pijll (rejected...)
@a^+=(!$a++,@a)for 0..pop;print"@a

"One cannot delete the Web browser from KDE without
losing the ability to manage files on the user's own
hard disk." - Prof. Stuart E Madnick, MIT. 
So called "expert" witness for Microsoft. 2002/05/02

Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About