解:使用sg函数打表发现规律,然后暴力异或起来即可。

 #include <bits/stdc++.h>

 typedef long long LL;
const int N = ; int a[N]; inline LL sg(LL x) {
int t = x & ;
if(t == || t == ) return x;
if(t == ) return x + ;
return x - ;
} inline void solve() {
int n;
LL ans = ;
scanf("%d", &n);
for(int i = ; i <= n; i++) {
scanf("%d", &a[i]);
ans ^= sg(a[i]);
}
if(ans) {
printf("Alice\n");
}
else printf("Bob\n");
return;
} int main() {
int T;
scanf("%d", &T);
while(T--) solve();
return ;
}

AC代码

HDU3032 Nim or not Nim?的更多相关文章

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

    [HDU3032]Nim or not Nim?(博弈论) 题面 HDU 题解 \(Multi-SG\)模板题 #include<iostream> #include<cstdio& ...

  2. 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 ...

  3. 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 ...

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

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

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

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

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

  10. 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. 关于vagrant一个虚拟机搭建多个项目配置(总结)

    问题1:执行vagrant status命令,报错,没有找到命令,翻译:“vargrant bash命令没有找到.” 解答:因为在/home目录中,所有无法执行该命令,需要切换到外部进行执行 问题2: ...

  2. Spring boot+ logback环境下,日志存放路径未定义的问题

    日志路径未定义 环境:Spring boot + logback 配置文件: <configuration> <springProfile name="dev"& ...

  3. Dart语法基础

    hello world // Define a function. printNumber(num aNumber) { print('The number is $aNumber.'); // Pr ...

  4. Json dump

    json 模块提供了一种很简单的方式来编码和解码JSON数据. 其中两个主要的函数是 json.dumps() 和 json.loads() , 要比其他序列化函数库如pickle的接口少得多. 下面 ...

  5. eclipse 启动问题Eclipse启动时报错:A Java RunTime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No java virtual machine was found after searching the following locat

    从其他人直接复制的环境导致的问题. 正常双击出现当前异常,以管理员权限启动可以正常启动. ---------------------------Eclipse--------------------- ...

  6. Javassist之常用API的应用 02

    测试模型代码: package org.study2.JavaSenior.annotation.javassistDemo; /** * @Auther:GongXingRui * @Date:20 ...

  7. Python——进程通信之间数据共享

    from multiprocessing import Manager,Process,Lock def main(dic,lock): lock.acquire() dic['count'] -= ...

  8. mesh函数

    [t,W]=meshgrid([2:0.2:7],[0:pi/6:3*pi]); %设置时-频相平面网格点 Gs1=(1/(sqrt(2*pi)*a))*exp(-0.5*abs((t1-t)/a). ...

  9. fftshift

    说明:本文为转载http://blog.csdn.net/myathappy/article/details/51344618 Matlab fftshift 详解 一.实信号情况 因为实信号以fs为 ...

  10. React Router 4.0 ---- 嵌套路由和动态路由

    嵌套路由,从广义上来说,分为两种情况:一种是每个路由到的组件都有共有的内容,这时把共有的内容抽离成一个组件,变化的内容也是一个组件,两种组件组合嵌套,形成一个新的组件.另一种是子路由,路由到的组件内部 ...