Facebook Hacker Cup: Power Overwhelming

Posted by marcog on Stack Overflow See other posts from Stack Overflow or by marcog
Published on 2011-01-15T17:52:20Z Indexed on 2011/01/15 18:54 UTC
Read the original article Hit count: 218

A lot of people at Facebook like to play Starcraft II™. Some of them have made a custom game using the Starcraft II™ map editor. In this game, you play as the noble Protoss defending your adopted homeworld of Shakuras from a massive Zerg army. You must do as much damage to the Zerg as possible before getting overwhelmed. You can only build two types of units, shield generators and warriors. Shield generators do no damage, but your army survives for one second per shield generator that you build. Warriors do one damage every second. Your army is instantly overrun after your shield generators expire. How many shield generators and how many warriors should you build to inflict the maximum amount of damage on the Zerg before your army is overrun? Because the Protoss value bravery, if there is more than one solution you should return the one that uses the most warriors.

Constraints

  • 1 = G (cost for one shield generator) = 100
  • 1 = W (cost for one warrior) = 100
  • G + W = M (available funds) = 1000000000000 (1012)

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about math