SEND + MORE = MONEY: Difference between revisions
m
→Fast: Add optimizations and timing
Thundergnat (talk | contribs) m (Remove double header) |
Thundergnat (talk | contribs) m (→Fast: Add optimizations and timing) |
||
Line 118:
=== Fast ===
Alternately, a version written in 2015 by [http://strangelyconsistent.org/blog/send-more-money-in-perl6 Carl Mäsak]. Not very concise but quite
<syntaxhighlight lang="raku" line>my int $s =
while ++$s <= 9 {
next if $s == 0;
Line 140:
my int $send = $s*1000 + $e*100 + $n*10 + $d;
my int $m =
}
}
Line 189 ⟶ 182:
}
}
}
printf "%.3f elapsed seconds", now - INIT now;</syntaxhighlight>
{{out}}
<pre>SEND + MORE == MONEY
9567 + 1085 == 10652
0.080 elapsed seconds</pre>
=={{header|Ring}}==
|