This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
First thoughts were "let's think this through, surely there's some analytical way to solve it", second thoughts were, "nah, brute force!"... Eventually went back to the thinking board and got somewhere similar to @patrick_digan
Here sharing but really here to find a better solution. Did anyone use an optimization algorithm, not just every position?
finally got it...
Anyone figured out Part 2 without generating rows? I mean, I'm pretty sure it'd work taking account of the mean and the Std. Dev. or some sort of normalization, but couldn't figure it out myself (always too high on the score).
Variations on a theme, and took a somewhat brute force approach, and a very mathematical one.
Once all of the possible horizontal positions were aligned with each unique starting number, I calculated the number of steps (absolute value of the original number - the horizontal position)
For part 1, a summarize tool to add up the total number of steps per horizontal position per unique number. Take the results, multiply each by the number of times each number appears in the data set, summarize again for the total steps per horizontal position and sort ascending
For part 2, need to calculate the cost. This is all about adding consecutive numbers, so the formula of (n/2)*(1+n), where n represents the total number of steps for each number to the horizontal position comes into play.
Helping Sigal (my eldest) study for the SHSATs (NYC specialized high school entrance test) actually gave me the formula I needed to solve this one with a simple row by row, math approach.
Triangle numbers for the tool golf win
Dan
Who knew there was so much controversy about crab movement!
Hmmm, I see a lot of solutions with "generate rows". Didn't even occur to me to try that. I only considered aligning to a position that at least one crab started at (634 distinct positions to start). Used those 634 positions as the control parameters into a batch macro. Part 1 was easy - distance/fuel = number of moves. Part 2 wasn't horrendous - as another stated, just (moves/2)*(1+moves).