Проблем със задача: Japanese Roulette
Здравейте колеги,
Моля за малко помощ за следнта задача:
Japanese Roulette
Russian roulette is a game of chance where a single player places a single bullet in a revolver, spins the cylinder, points the muzzle against their head and pulls the trigger. Japanese people however are not that brave (crazy) so they play with toy guns.
Every player can spin the cylinder with different strength. The numeric representation of the strength is with how many places they can move the bullet while spinning. Note that the cylinder has only 6 places but the strength could be much more than 6 due to several rotations of the cylinder.
You are given an array of integers which represent the cylinder of the revolver where 0 means empty and 1 represents the bullet. There is exactly one bullet in the cylinder.
You will receive another array, this time of strings where every index is a different player and every value is the strength of the player and the direction to which the player rotates the cylinder.
The elements in the array will be separated by spaces. The power and the direction will be separated by a comma (”,”) e.g.: “111,Left”.
The muzzle IS at index 2 of the cylinder. If the element at that position is 1, the current player loses the game.
Note! After a player pulls the trigger the cylinder spins with one position to the right. The next player starts spinning with the new state of the cylinder.
Assume that the order of the players is according to their places in the array. The player with index 0 shots first, index 1-second and so on…
Your task is to go through all players, and see if anyone will shoot himself with the toy gun.
Input / Constrains
· First line – 6 integers, separated by a space (only 0 or 1, where 1 once and 0 five times) which represent the cylinder.
· Second line –strings, separated by a space, representing the strength and the direction to which every player rotates. The strength and direction for a single player are separated by a comma.
Output
· If someone loses the game you should print on the console “Game over! Player {index} is dead.”, where index is the index of the player in the array. The game ends and so does your program.
· If no one lost, you should just print: “Everybody got lucky!”
Examples
Input |
Output |
0 0 0 0 1 0 10,Right 11,Left 140,Right 1,Left 30,Right
|
Game over! Player 0 is dead. |
Input |
Output |
0 0 1 0 0 0 1,Right 2,Left 5,Left
|
Game over! Player 1 is dead. |
Ето го и моето решение, но Judge ми дава само 20 точки.