#P7656. [BalticOI 1996] A NUMBER GAME (Day 2)
[BalticOI 1996] A NUMBER GAME (Day 2)
Description
Below is a game. First, we assign integer values to the variables and . Players A and B then take turns making moves (A goes first). In each move, a positive integer is chosen, which decreases the value of by . However, it is not allowed to use a number that has already been used in any previous move by either player. The game ends when one player cannot make a move. The player who makes the last move wins.
Please write a program to determine which player has a winning strategy.
Input Format
The first line contains two integers and , separated by a space.
Output Format
The first line: who has a winning strategy. The following lines: list all possible first moves of A in increasing order, followed by the word “winning” or by a winning response of B.
3 2
B wins
1 2
2 1
7 4
A wins
1 winning
2 winning
3 4
4 3
Hint
Constraints
For of the testdata, , .
Scoring
The score of this problem follows the original BOI setting, with a full score of .
Problem Notes
From Baltic Olympiad in Informatics 1996: Day 2:A NUMBER GAME.
Translated and organized by @求学的企鹅.
Translated by ChatGPT 5
京公网安备 11011102002149号