The second problem on Google CodeJam 2013, Round 1B was interesting: Problem B. Manage your Energy . The obvious solution of trying all the possible cases and combinations would not work, unless the input had very small limits (besides being not so easy to implement).