
GameOfMatches
Ngoc and Phong are playing a game with a starting number of matches. Ngoc always plays first, and they move in alternating turns. The game’s rules are as follows:
- In a single move, a player can remove either , , or matches from the game board.
- If a player is unable to make a move, that player loses the game.
Given the starting number of matches , find and print the name of the winner assuming both players play optimally.
Example
- For
n = 4
, the output should be GameOfMatches(n) = "Ngoc"
. Ngoc removes three matches leaving one match left, Phong can not make a move and loses
Input/Output
-
[execution time limit] 1 second
-
[input] integer n
Guaranteed constraints:
0 ≤ n ≤ 10^6
-
[output] string
Return the name of the the winner.
Post Comment