| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1111 人关注过本帖
标题:帮忙看看这道题目的思路,我觉得奇怪
取消只看楼主 加入收藏
枫叶无痕
Rank: 2
等 级:论坛游民
帖 子:80
专家分:30
注 册:2011-2-10
结帖率:73.91%
收藏
 问题点数:0 回复次数:1 
帮忙看看这道题目的思路,我觉得奇怪
Game

Time Limit:1000MS  Memory Limit:65536K
Total Submit:6 Accepted:2

Description

Bill is fond of computer games. He likes to analyze games and to provide efficient solutions. Now, he is studying the following game. The game starts with a n x n matrix filled with positive integers. When it is her/his turn, a player can delete the last row or the last column of the matrix, if the sum of the numbers in that row/column is even. If a player cannot delete the last row or the last column on his turn, then he loses the game. Bill thinks that this game can be classified as first player wins (W) or first player loses (L). First player wins means that the first player has a strategy to win, no matter how the second player plays the game. First player loses means that no matter what the first player does the second player has a strategy to win.
Bill is also a skilled programmer. He wants to write a program to classify the game quickly. Can you help him?

Input

The program input is from a text file. Each data set in the file stands for a particular game. A data set starts with the number n (n  1000), the matrix dimension, followed by the positive integers in the matrix. The program has to print W if the first player wins the game, or L if the first player loses the game.

Output

White spaces can occur freely in the input. The input data are correct and terminate with an end of file. For each set of data the program prints the result to the standard output from the beginning of the line. An input/output sample is in the table bellow. There are two data sets. In the first case, the matrix dimension n is 2. The integers in the matrix are: 2 4 6 8. The result for the data set is L, meaning that no matter what the first player does, the second player wins.

Sample Input


2
2 4
6 8
3
5 4 2
1 5 9
7 3 8
Sample Output


L
W

帮忙看看这道题目的思路
搜索更多相关主题的帖子: efficient following positive computer studying 
2011-08-22 14:16
枫叶无痕
Rank: 2
等 级:论坛游民
帖 子:80
专家分:30
注 册:2011-2-10
收藏
得分:0 
回复 3楼 voidx
可不可以说一下这个思路可不可以说一下这个思路
2011-08-22 14:48
快速回复:帮忙看看这道题目的思路,我觉得奇怪
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020524 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved