Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Golfed, I get you down to 140, assuming the inputs are ordered smallest to largest. Interestingly enough, if you have the defined-or patch, I get down to 122. If the inputs aren't ordered, add 13 characters to both solutions.
Without //= patch: @x=@_;my%c;$e=sub{my$v=pop;exists$c{$v}?$c{$v}:$c{$v}=$v<0?0:$v==0||gr +ep&$e($v-$_),@x};$t=$s=0;{&$e(++$t)?$t-$s>=$x[0]&&last:($s=$t);redo}$ +s With //= patch: @x=@_;my%c;$e=sub{my$v=pop;$c{$v}//=$v<0?0:$v==0||grep&$e($v-$_),@x};$ +t=$s=0;{&$e(++$t)?$t-$s>=$x[0]&&last:($s=$t);redo}$s

Update: Actually, the inputs don't have to be ordered. It just means that the algorithm will take a little longer, but it will get the right results. Also, drop a character by reordering the assignment to $c{$v}. The //= patched version looks like:
@x=@_;my%c;$e=sub{my$v=pop;$c{$v}//=$v==0||$v>0&&grep&$e($v-$_),@x};$t +=$s=0;{&$e(++$t)?$t-$s>=$x[0]&&last:($s=$t);redo}$s

Update: Rewriting the redo-loop as a C-style for-loop drops to 111 characters for the //= patched version.
@x=@_;my%c;$e=sub{my$v=pop;$c{$v}//=!$v||$v>0&&grep&$e($v-$_),@x};for( +$t=$s=0;$t-$s<$x[0];&$e(++$t)or$s=$t){}$s

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

In reply to Re^2: Golf: Buying with exact change by dragonchild
in thread Golf: Buying with exact change by blokhead

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (4)
    As of 2018-05-20 22:06 GMT
    Find Nodes?
      Voting Booth?