#P10501. Cutting Game

Cutting Game

题目描述

Urej loves to play various types of dull games. He usually asks other people to play with him. He says that playing those games can show his extraordinary wit. Recently Urej takes a great interest in a new game, and Erif Nezorf becomes the victim. To get away from suffering playing such a dull game, Erif Nezorf requests your help. The game uses a rectangular paper that consists of W×HW \times H grids. Two players cut the paper into two pieces of rectangular sections in turn. In each turn the player can cut either horizontally or vertically, keeping every grids unbroken. After NN turns the paper will be broken into N+1N+1 pieces, and in the later turn the players can choose any piece to cut. If one player cuts out a piece of paper with a single grid, he wins the game. If these two people are both quite clear, you should write a problem to tell whether the one who cut first can win or not.

输入格式

The input contains multiple test cases. Each test case contains only two integers WW and H(2W,H200)H (2 \le W , H \le 200) in one line, which are the width and height of the original paper.

输出格式

For each test case, only one line should be printed. If the one who cut first can win the game, print "WIN", otherwise, print "LOSE".

题目大意

【题目描述】

Urej 喜欢玩各种类型的沉闷游戏。他通常会邀请其他人和他一起玩。他说,玩这些游戏可以展现他的非凡智慧。最近,Urej 对一个新游戏产生了极大兴趣,而 Erif Nezorf 成为了牺牲品。为了摆脱玩这样一个沉闷游戏的痛苦,Erif Nezorf 请求你的帮助。这个游戏使用一个由 W×HW \times H 格网组成的矩形纸张。两名玩家轮流将纸张切割成两个矩形部分。在每个回合中,玩家可以横向或纵向切割,保持每个格网完整。经过 NN 轮后,纸张将被切割成 N+1N+1 片,然后在后续的回合中,玩家可以选择任意一片进行切割。如果一名玩家切割出一个只有一个格网的纸片,他就赢得了游戏。如果这两个人都非常清楚,你应该写一个问题来告诉是否先手的玩家能赢得游戏。

【输入格式】

输入包含多个测试用例。每个测试用例在一行中只包含两个整数 WWH(2W,H200)H (2 \le W , H \le 200),分别表示原始纸张的宽度和高度。

【输出格式】

对于每个测试用例,应该只输出一行。如果先手的玩家能赢得游戏,则输出 "WIN",否则输出 "LOSE"。

翻译来自于:ChatGPT

2 2
3 2
4 2
LOSE
LOSE
WIN