You have an augmented reality game in which you catch Edoc and acquire Edoc candy. You need

Question:

You have an augmented reality game in which you catch Edoc and acquire Edoc candy. You need 12 candies to evolve an Edoc into a Margorp. An evolution earns you back one candy. Each evolution also earns you 500 experience points. An Edoc or Margorp can each be transferred for one Edoc candy. In support of the game’s players, write an Edoc calculator program that inputs the number of Edoc you have caught and the number of Edoc candies in your possession. You can assume the initial number of Margorps is 0. The program should output the maximum number of experience points you can earn through transfers and evolutions. After Edocs evolve into Margorps, your program should consider if transferring the Margorps will result in enough candy to evolve even more Edoc.

For example, if you start with 71 candies and 53 Edoc, the program could output the following. Note that there are many other sequences of transfers and evolutions, with possibly a different final number of Edoc and Margorp, but the total number of experience points should be the same (the max possible):

Transfer 37 Edoc and 0 Margorp resulting in 108 candy, 16 Edoc, and 0 Margorp
Evolve 9 Edoc to get 4500 experience points and resulting in 9 candy, 7 Edoc, and 9 Margorp
Transfer 0 Edoc and 9 Margorp resulting in 18 candy, 7 Edoc, and 0 Margorp
Evolve 1 Edoc to get 500 experience points and resulting in 7 candy, 6 Edoc, and 1 Margorp
Transfer 4 Edoc and 1 Margorp resulting in 12 candy, 2 Edoc, and 0 Margorp
Evolve 1 Edoc to get 500 experience points and resulting in 1 candy, 1 Edoc, and 1 Margorp

Total experience points = 5500

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: