Queen of angle
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
In the lower left corner of the board M×N is the queen. Two players take turns walking the queen, moving it to any number of cells vertically upwards, horizontally to the right, or diagonally to the right and upwards.
The winner is the one who put the queen in the top right corner of the board. Determine which of the players has a winning strategy.
Input
The input to the program of fed two natural numbers M and N, not exceeding 100.
Output
The program should print player number (1 or 2) who has a winning strategy.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 17%