hdu 4642 翻硬币

在一个n*m的棋盘上 每一个格子都有一枚硬币 1表示正面 0表示反面
你每次可以选择一个硬币为正面的点,然后从该点与右下角点形成的矩阵硬币全都反向,直到一个人没有硬币可以选择则输
Alice先手

列举了几种情况 发现只要最右下角的格子是1 则先手必胜

Sample Input
2
2 2 // n m
1 1
1 1
3 3
0 0 0
0 0 0
0 0 0

Sample Output
Alice
Bob

 

 1 # include <iostream>
 2 # include <cstdio>
 3 # include <cstring>
 4 # include <algorithm>
 5 # include <string>
 6 # include <cmath>
 7 # include <queue>
 8 # include <list>
 9 # define LL long long
10 using namespace std ;
11 
12 int n , m ;
13 
14 int main()
15 {
16     //freopen("in.txt","r",stdin) ;
17     int T ;
18     scanf("%d" , &T) ;
19     while(T--)
20     {
21         scanf("%d %d" , &n , &m) ;
22         int i , j  , x;
23         for (i = 0 ; i < n ; i++)
24             for (j = 0 ; j < m ; j++)
25                 scanf("%d" , &x) ;
26         if (x)
27             printf("Alice\n") ;
28         else
29             printf("Bob\n") ;
30     }
31 
32 
33     return 0;
34 }
View Code

 

转载于:https://www.cnblogs.com/mengchunchen/p/4843736.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值