先打个表冷静一下

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=,inf=; int f[N],sg[N],Hash[N];//f是可以取走的石子书
void getsg(int n)
{
memset(Hash,,sizeof Hash);
for(int i=;i<n;i++)
Hash[sg[i]]=;
for(int i=;i<=n;i++)
for(int j=;j<=n;j++)
if(i+j==n)
Hash[sg[i]^sg[j]]=;
for(int i=;;i++)
if(!Hash[i])
{
sg[n]=i;
break;
}
cout<<n<<" "<<sg[n]<<endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie();
for(int i=;i<=;i++)
getsg(i);
return ;
}

可以看出sg【i】=i;i%4==1||2

sg[i]=i+1,i%4==3

sg[i]=i-1,i%4==4

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=,inf=; int main()
{
ios::sync_with_stdio(false);
cin.tie();
int t,n,a;
cin>>t;
while(t--){
cin>>n;
int ans;
for(int i=;i<n;i++)
{
cin>>a;
if(a%==)a++;
else if(a%==)a--;
if(i==)ans=a;
else ans=ans^a;
}
if(!ans)cout<<"Bob"<<endl;
else cout<<"Alice"<<endl;
}
return ;
}

hdu3032sg打表找规律的更多相关文章

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

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

  2. HDU 5753 Permutation Bo (推导 or 打表找规律)

    Permutation Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequen ...

  3. HDU 4861 Couple doubi (数论 or 打表找规律)

    Couple doubi 题目链接: http://acm.hust.edu.cn/vjudge/contest/121334#problem/D Description DouBiXp has a ...

  4. HDU2149-Good Luck in CET-4 Everybody!(博弈,打表找规律)

    Good Luck in CET-4 Everybody! Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ...

  5. 【ZOJ】3785 What day is that day? ——浅谈KMP在ACM竞赛中的暴力打表找规律中的应用

    转载请声明出处:http://www.cnblogs.com/kevince/p/3887827.html    ——By Kevince 首先声明一下,这里的规律指的是循环,即找到最小循环周期. 这 ...

  6. HDU 5795 A Simple Nim(SG打表找规律)

    SG打表找规律 HDU 5795 题目连接 #include<iostream> #include<cstdio> #include<cmath> #include ...

  7. hdu_5894_hannnnah_j’s Biological Test(打表找规律)

    题目链接:hdu_5894_hannnnah_j’s Biological Test 题意: 有n个不同的位置围成一个圈,现在要安排m个人坐,每个人至少的间隔为k,问有多少种安排 题解: 先打表找规律 ...

  8. hdu_5795_A Simple Nim(打表找规律的博弈)

    题目链接:hdu_5795_A Simple Nim 题意: 有N堆石子,你可以取每堆的1-m个,也可以将这堆石子分成3堆,问你先手输还是赢 题解: 打表找规律可得: sg[0]=0 当x=8k+7时 ...

  9. hdu_5793_A Boring Question(打表找规律)

    题目链接:hdu_5793_A Boring Question 题意: 自己看吧,说不清楚了. 题解: 打表找规律 #include<cstdio> typedef long long l ...

随机推荐

  1. 使用异步消息处理更新UI线程

    1. Android的UI时线程不安全的,如果在子线程中更新UI会出现异常,导致程序崩溃. 为了解决如上这些问题,我们常用的做法就是使用Android的异步消息机制实现即可(创建一个Message对象 ...

  2. Git 基本操作(二)

    1. 分支操作 1.1 Fast-forward 当被合并分支(C4)位于合并分支(C2)的历史线上,此时的合并称为"fast-forward"; // hotfix 被合并到 m ...

  3. APM最佳实践: 诊断平安城市视频网性能问题

    前言: 平安城市已经是一个关系你我他的民生工程,但由于本身系统的复杂性,给运维工作带来了极大的挑战.如何保障摄像头在线率?如何在系统中找到视频系统故障的问题所在?在我们某一次项目经历中,APM在发现问 ...

  4. (2.14)Mysql之SQL基础——游标

    (2.14)Mysql之SQL基础——游标 关键词:Mysql游标 -- (1)定义游标 declare cur_name cursor for select * from table_name wh ...

  5. mysql 数据操作 单表查询 group by group_concat() 函数

    # group_concat() 和concat() 一样拼接字符串 用在分组里 需求:查看每个职位都有哪些员工名字 把所有员工成员的名字都列出来 把每个职位里的员工姓名列出来 mysql> s ...

  6. centos linux系统日常管理复习 CPU物理数逻辑核数,iftop ,iotop ,sar ,ps,netstat ,一网卡多IP,mii-tool 连接,ethtool速率,一个网卡配置多个IP,mii-tool 连接,ethtool速率 ,crontab备份, 第十八节课

    centos linux系统日常管理复习 物理CPU和每颗CPU的逻辑核数,uptime ,w,vmstat,iftop ,iotop ,sar ,ps,netstat ,一个网卡配置多个IP,mii ...

  7. mysql创建和删除表

    创建表 简单的方式 CREATE TABLE person ( ), name ), birthday DATE ); 或者是 CREATE TABLE IF NOT EXISTS person ( ...

  8. A Basic Example of Threads Synchronization in Python, python中的线程同步示例

    http://zulko.github.io/blog/2013/09/19/a-basic-example-of-threads-synchronization-in-python/ We will ...

  9. HDU:Gauss Fibonacci(矩阵快速幂+二分)

    http://acm.hdu.edu.cn/showproblem.php?pid=1588 Problem Description Without expecting, Angel replied ...

  10. 一个简单的3D范例,是在别人基础上面整理的。

    一个简单的范例,是在别人基础上面整理的.原来的例子,框图太乱了,没有条理感. http://pan.baidu.com/s/1eQTyGCE