题意:R*C方格中,每个格子有一定石子,每次移动每格任意数量石子,只能向下或者向右动一格,不能移动为败
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
typedef long long LL;
using namespace std;
const int maxn=50005;
/*
单看一个位置,与右下角的距离有关,和此点坐标无关。
若距离为偶,那此点和没有一样,因为先手做什么后手把相同数量的石子往后移便可
也相当于必输,sg=0,处不处理每区别
若距离为奇数,可移动1~x个,后手处理在偶数位置的石子没意义,只能继续处理当前奇数位置石子
相当于任取数量的nim博弈
一个很重要的思想是,若先手,后手可以以同样的方式抵消,那么这个方式就可以看作没有(往往)。
*/
int main()
{
int T,time=0;
scanf("%d",&T);
while(T--){
int R,C;
scanf("%d%d",&R,&C);
int ans=0, a;
for(int i=1; i<=R; i++){
for(int j=1; j<=C; j++){
scanf("%d",&a);
if((R-i+C-j)%2)
ans ^= a ;
}
}
printf("Case %d: ",++time);
if(ans==0) printf("lose\n");
else printf("win\n");
}
}