HDU4642博弈好题

链接:http://acm.hdu.edu.cn/

两个人进行翻棋游戏,若a[n][m]为1,则不管先手就可以翻a[n][m]使其为0,这样不管后手翻什么都会使得a[n][m]为1,先手总是有棋可翻;而若a[n][m]为0,先手 总会面临无棋可翻的状态,因此只需要判断a[n][m]的值即可求解

#include<iostream>
#include<cstdio>
using namespace std;
const int maxn=100+10;
int a[maxn][maxn];
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,m;
        scanf("%d%d",&n,&m);
        for(int i=1;i<=n;i++)
            for(int j=1;j<=m;j++)
            scanf("%d",&a[i][j]);
        if(a[n][m]==1)
            printf("Alice\n");
        else
            printf("Bob\n");
    }
    return 0;
}



posted @ 2014-08-02 13:18  wolf940509  阅读(173)  评论(0)    收藏  举报