P21779 [GeeksforGeeks] Moving on grid1135
普及-
题目描述

Given a grid on XY plane with dimensions r x c, the two players (say JON and ARYA ) can move the coin over the grid satisfying the following rules:
There is a coin on (1,1) cell initially.
JON will move first.
Both will play on alternate moves.
In each move they can place coin on following positions if current position of coin is x,y
(x+1,y), (x+2,y), (x+3,y), (x,y+1), (x,y+2), (x,y+3), (x,y+4), (x,y+5), (x,y+6)
They can't go outside the grid.
Player who cannot make any move will lose this game.
Both play optimally.
Example 1:
Input: r = 1, c = 2
Output: JON
Explanation: ARYA lost the game because
he won't able to move after JON's move.
Example 2:
Input: r = 2, c = 2
Output: ARYA
Explanation: After first move by JON(1,2 or 2,1)
and second move by ARYA(2,2) JON won't able to
move so ARYA wins.
Your Task:
You dont need to read input or print anything. Complete the function movOnGrid() which takes r and c as input parameter and returns the name of the winner ( either JON or ARYA).
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
1 <= r, c <=10^{5}

输入格式

见题面

输出格式

见题面

样例输入
r = 1, c = 2
样例输出
JON