Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. How to solve this dynamic programming problem with haskell ? (Osager Prairie) ---------------------------------------------------------------------- Message: 1 Date: Fri, 2 Mar 2012 14:28:19 +0100 From: Osager Prairie <osagerprai...@gmail.com> Subject: [Haskell-beginners] How to solve this dynamic programming problem with haskell ? To: Beginners@haskell.org Message-ID: <ca+q7gyzmp4et9k_lofkx6fgb2jx+s6ib+ounbcraedcdv1+...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Hi all: I saw this problem from Topcoder I understand that it can be solved with dynamic programming with a bottom-up approach. But I really don't know how to implement it in Haskell. Could anyone help me out ? For the moment my haskell muscle only allows me to solve some naive list processing problems. I really need to strengthen up. Thanks in advance Problem Statement The Casket of Star (sic) is a device in the Touhou universe. Its purpose is to generate energy rapidly. Initially it contains n stars in a row. The stars are labeled 0 through n-1 from the left to the right. You are given a int[] weight, where weight[i] is the weight of star i. The following operation can be repeatedly used to generate energy: Choose a star x other than the very first star and the very last star. The x-th star disappears. This generates weight[x-1] * weight[x+1] units of energy. We decrease n and relabel the stars 0 through n-1 from the left to the right. Your task is to use the device to generate as many units of energy as possible. Return the largest possible total amount of generated energy. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20120302/75d96b1f/attachment-0001.htm> ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 45, Issue 2 ****************************************