Game of Marienbad
Statement
Goal
Marienbad is a strategy game where matches are put on a table. Each of your turns, you can take either 1, 2 or 3 matches. You lose if you take the last match.Alice and Bob are playing the game of Marienbad with n matches. Given who begins and how many matches were removed each turn, tell if
Note that if only one match is left, you can tell who will win.
Input
beginner: The name of the first player
n: The number of matches at the beginning
r: Number of rounds to come
r space separated numbers: The number of matches removed (either1 ,2 or 3 )
n: The number of matches at the beginning
r: Number of rounds to come
r space separated numbers: The number of matches removed (either
Output
Either Alice , Bob or Nobody
Constraints
beginner is either Bob or Alice
10 ≤ n ≤ 100
3 ≤ r ≤ 100
10 ≤ n ≤ 100
3 ≤ r ≤ 100
Example
Input
Bob 13 6 3 2 3 2 2 1
Output
Bob
Game modes
Fastest, Shortest
Test cases
Classic game Test
Input
Bob
13
6
3 2 3 2 2 1
Output
Bob
Classic game validator Validator
Input
Bob
13
7
2 2 3 1 3 1 1
Output
Alice
One match left Test
Input
Alice
10
4
2 3 2 2
Output
Bob
One match left validator Validator
Input
Bob
10
4
3 3 2 1
Output
Alice
More matches left Test
Input
Bob
10
2
3 3
Output
Nobody
More matches left validator Validator
Input
Alice
12
3
2 3 2
Output
Nobody
Not so clever Test
Input
Alice
15
6
3 2 2 3 2 3
Output
Alice
Not so clever validator Validator
Input
Bob
13
6
1 2 3 3 2 2
Output
Bob
Solution language
Solution
Stub generator input