2 shunfurh shunfurh 于 2017.01.04 00:08 提问

Cutting Game

Description

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*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 N turns the paper will be broken into N+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.
Input

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

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".
Sample Input

2 2
3 2
4 2
Sample Output

LOSE
LOSE
WIN

1个回答

caozhy
caozhy   Ds   Rxr 2017.01.09 23:53
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
FZU2268 Cutting Game(数学,规律)(第七届福建省大学生程序设计竞赛)
题目: Problem 2268 Cutting Game Accept: 10    Submit: 12 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Fat brother and Maze are playing a kind of special (hentai
POJ 2311 Cutting Game (SG函数)
转载请注明出处,谢谢 http://blog.csdn.net/ACM_cxlove?viewmode=contents           by---cxlove 题目:给出一个N*M的纸片,每一次可以把一部分剪成两部分,谁剪出1*1的就赢了。 http://poj.org/problem?id=2311 对于任何一个人,都不会先剪出1*n或者n*1,应该这样就必败了。 那我们考
POJ 2311 Cutting Game (sg函数)
给出一个N*M的纸片,每一次可以把一部分剪成两部分,谁剪出1*1的就赢了。 http://poj.org/problem?id=2311 对于任何一个人,都不会先剪出1*n或者n*1,应该这样就必败了。 那我们考虑一个状态的后继中,最小的边也是2,这样就可以避免之前的问题,也不需要考虑类似ANTI-SG。 一旦出现2*2,2*3,3*2,这些都成了终止状态,不论怎么剪都
poj 2311 Cutting Game (sg函数)
小记:这题是对sg函数的初步理解。 对于sg函数只要 g[x] == 0,则此时为必败态。 x作为后继,我们就要对所有的后继进行标记,然后mex之。 因为每次只能切一刀,所以切完之后,会有两块方格,而对每一块方格进行游戏又会有一个sg函数值, 所以根据sg函数的性质,它这一刀所代表的后继,即为这两块方格的sg函数值的异或值(即为x)。 然后根据后继mex之。 mex的到的值即为此态的s
POJ Cutting Game(Nim博弈+grundy数)
Description 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
POJ2311 Cutting Game (博弈)
Cutting GameTime Limit: 1000MS Memory Limit: 65536KDescriptionUrej 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 h
Cutting Game---博弈
#include "iostream" #include "vector" #include "string.h" #include "set" using namespace std;int mem[200][200];int grundy(int w, int h) { if(mem[w][h] != -1) return mem[w][h]; int i;
POJ-2311-Cutting Game
求SG
POJ 2311-Cutting Game(Nim博弈-sg函数/记忆化搜索)
Cutting Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3632   Accepted: 1352 Description Urej loves to play various types of dull games. He usually ask
FZU2264,2265,2266 Card Game 系列 (数学,规律)(第七届福建省大学生程序设计竞赛)
题目: Problem 2264 Card Game (First Edition) Accept: 5    Submit: 17 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Fat brother and Maze are playing a kind of spe