Re:programming challenge
by ciju on Sunday October 17, 2010 @05:56AM
(#1800017)
is there a need for jar2:3 at line 12 ?
[ Parent
| on HN ]
Doesn't seem like there is. Also, is my count wrong, or does that only produce 31 white balls? It's still more than the 29, though.
We have 5 from the start.
Start producing 4 more (2 jars) at timestep 1.
Start producing 4 more at timestep 6.
Start producing 22 more at timestep 12.
22 + 4 + 4 + 5 = 35
Oh, I did it by hand (and I was checking all the balls). I just missed one of the +4s somehow.
I wonder how efficient people can make this. I've envisioned all kinds of test cases that crank up the branching factor, require that you find solutions even if you have to trade away white balls for them and other such things.
Just because he made them positive integers doesn't mean that there are no ways to punish solutions that won't scale or those that don't always find optimal solutions.