The author of the previous problem is half a psycho, half a freak. He is well know for his lengthy and weird statements, although a few of his problems are not that hard. Consider for instance the following adaptation of an old problem of the same author.
The rules of Snakes and Ladders (see the board below) are simple:
You must simulate several of these games using pseudo-random numbers. In particular, include the <random> library, and declare a global
mt19937 rng;
variable. Every game will be defined by a seed s. Just do
rng.seed(s);
to reset rng before every game. Afterwards, every time that you need the result d of the next rolling of the die, use this code:
unsigned int r = rng(); int d = r%6 + 1;
For instance, with the initial seed 42, we get these values for r: 1608637542, 3421126067, 4083286876, 787846414, …Therefore, the values for d are 1, 6, 5, 5, …In this game, red goes to 2 (and then to 38), blue goes to 7 (and then to 14), blue moves again (he got a 6) and goes to 19, red goes to 43, …, and eventually blue wins.
Input
Input consists of several games, each one defined by an integer seed s between 1 and 109.
Output
For each game, print “RED” or “BLUE” depending on the winner.
Input
42 1 999999999 1000000000
Output
BLUE BLUE RED BLUE