hdu 5011 nim博弈 (2014西安网赛E题)


n堆石子,每次可以选一堆取走至少一个,之后你可以不操作或者把该堆石子分成两堆,每堆至少一个,和还是原来(取完石子后)的石子个数。


Sample Input
1
1
2
1 1
3
1 2 3

Sample Output
Win
Lose
Lose

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

优质内容筛选与推荐>>
1、Replication的犄角旮旯(九)-- sp_setsubscriptionxactseqno,赋予订阅活力的工具
2、asp.net(C#)海量数据表高效率分页算法(易懂,不使用存储过程)
3、调用支付宝接口Android客户端没有支付宝APP的情况下解决无法调用支付宝页面的问题
4、搭建USB摄像头转RTSP服务器的多种方法
5、ASP分页代码


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号





    联系我们

    欢迎来到TinyMind。

    关于TinyMind的内容或商务合作、网站建议,举报不良信息等均可联系我们。

    TinyMind客服邮箱:support@tinymind.net.cn