【HDU3032】Nim or not Nim?(博弈论)

题面

HDU

题解

\(Multi-SG\)模板题

#include<iostream>
#include<cstdio>
using namespace std;
inline int read()
{
int x=0;bool t=false;char ch=getchar();
while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
if(ch=='-')t=true,ch=getchar();
while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
return t?-x:x;
}
int SG(int x)
{
if(x%4==0)return x-1;
if(x%4==1)return x;
if(x%4==2)return x;
if(x%4==3)return x+1;
}
int main()
{
int T=read();
while(T--)
{
int n=read(),s=0;
while(n--)s^=SG(read());
puts(s?"Alice":"Bob");
}
return 0;
}

【HDU3032】Nim or not Nim?(博弈论)的更多相关文章

  1. Nim or not Nim? hdu3032 SG值打表找规律

    Nim or not Nim? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  2. HDU3032 Nim or not Nim?(Lasker’s Nim游戏)

    Nim or not Nim? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  3. HDU 5795 A Simple Nim(简单Nim)

    p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...

  4. hdu 3032 Nim or not Nim? (SG函数博弈+打表找规律)

    Nim or not Nim? Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Sub ...

  5. HDU 3032 Nim or not Nim? (sg函数求解)

    Nim or not Nim? Problem Description Nim is a two-player mathematic game of strategy in which players ...

  6. HDU 3032 Nim or not Nim? (sg函数)

    Nim or not Nim? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  7. hdu 3032 Nim or not Nim? sg函数 难度:0

    Nim or not Nim? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  8. HDU 3032 Nim or not Nim?(博弈,SG打表找规律)

    Nim or not Nim? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  9. HDU 3032 Nim or not Nim?(Multi_SG,打表找规律)

    Nim or not Nim? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

随机推荐

  1. 在做stark中一些反射的问题。

    hasattr(obj,name): 判断一个对象里面是否有name属性或者name方法,返回BOOL值,有name特性返回True, 否则返回False.需要注意的是name要用括号括起来   1 ...

  2. Python之缩进块

    pycharm编辑器识别冒号,当换行后下一行默认是缩进块的位置:

  3. jenkins 迁移后 提示 反向代理设置有误

    jenkins报:反向代理设置有误-布布扣-bubuko.comhttp://www.bubuko.com/infodetail-2038758.html [Linux][Jenkins]系统配置报反 ...

  4. 给网站配置免费的HTTS证书

    取经自思否:https://segmentfault.com/a/1190000015231137 https 的网站 搜索引擎 会优先收录,所以就抽时间记录下配置博客的过程,各种找资料,终于给我找到 ...

  5. 熟悉pyspider的装饰器

    熟悉pyspider的装饰器取经地点:https://segmentfault.com/a/1190000002477863 @config(age=10 * 24 * 60 * 60) 在这表示我们 ...

  6. [转帖]Gartner预测:2019年全球公有云规模达2143亿美元

    Gartner预测:2019年全球公有云规模达2143亿美元 https://news.cnblogs.com/n/623341/ 近日,全球领先的信息技术研究和顾问公司 Gartner 发布的最新数 ...

  7. cordova微信支付回调App闪退

    这是cordova版本太高,不兼容这个插件所导致的.解决方案是修改$your_project/plugins/cordova-plugin-wechat/scripts/android-install ...

  8. scala mkstring

    如果你想要把集合元素转化为字符串,可能还会添加分隔符,前缀,后缀. Solution 使用mkString方法来打印一个集合内容,下面给一个简单的例子: scala> val a = Array ...

  9. linux audit审计(8)--ausearch搜索audit日志文件

    ausearch这个工具,可以针对指定的事件来搜索audit日志文件.默认情况下,ausearch搜索/var/log/audit/audit.log这个文件. The ausearch utilit ...

  10. 不使用DataContext直接将ViewModels绑定到ItemsControl控件

    在常规的MVVM设计模式中,都是通过DataContext将ViewModels的一个对象绑定到View的DataContext中,从而完成相应地绑定,在本文中我们将通过另外的一种思路来将ViewMo ...