UVa 11459 - Snakes and Ladders

11459 - Snakes and Ladders

 * http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=26&page=show_problem&problem=2454

Summary
Simulation of the game "Snakes and Ladders" ("Chutes and Ladders" to Americans).

Explanation
Straightforward simulation.

Gotchas

 * Make sure you end the game immediately when someone wins, be it from reaching or exceeding square 100 on the die roll or reaching 100 by a ladder.
 * Even if the game is won, you need to read in the remaining die rolls.

Implementations

 * Even though the problem tells you to accommodate a million players, a thousand is adequate.

Input
2 4 1 10 5 100 2 6 4 5 2 6 2 3 4 1 2 1 3 4 99 3 4 6

Output
Position of player 1 is 3. Position of player 2 is 7. Position of player 3 is 100. Position of player 4 is 1. Position of player 1 is 100. Position of player 2 is 5.