Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 24th, 2012  |  syntax: None  |  size: 0.28 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. TopCoder solution with dynamic programming solution
  2. Choose a star x other than the very first star and the very last star.
  3. The x-th star disappears.
  4. This generates weight[x-1] * weight[x+1] units of energy.
  5. We decrease n and relabel the stars 0 through n-1 from the left to the right.