不管是否使用技能,发现操作前后所有堆二进制中1的个数之和不变。那么对于一个堆其实可以等价转换为一个k个石子的堆(k为该数二进制的个数),然后就是个nim游戏。

 1 #include<bits/stdc++.h>
2 using namespace std;
3 int t,n,ans,a[101];
4 int main(){
5 scanf("%d",&t);
6 for(int ii=1;ii<=t;ii++){
7 scanf("%d",&n);
8 for(int i=1;i<=n;i++)scanf("%d",&a[i]);
9 ans=n%2;
10 for(int i=1;i<=n;i++)
11 while (a[i]){
12 ans^=a[i]%2;
13 a[i]>>=1;
14 }
15 if (ans)printf("Case %d: Yes\n",ii);
16 else printf("Case %d: No\n",ii);
17 }
18 }

[hdu4388]Stone Game II的更多相关文章

  1. HDU4388:Stone Game II(博弈+思维)

    Stone Game II Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot ...

  2. hdu 4388 Stone Game II sg函数 博弈

    Stone Game II comes. It needs two players to play this game. There are some piles of stones on the d ...

  3. hdu 4388 Stone Game II

    Stone Game II HDU - 4388 题目大意: 给出n堆物品,每堆物品都有若干件,现在A和B进行游戏,每人每轮操作一次,按照如下规则: 1. 任意选择一个堆,假设该堆有x个物品,从中选择 ...

  4. HDU 4388 Stone Game II {博弈||找规律}

    Stone Game II Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot ...

  5. Leetcode--Last Stone Weight II

    Last Stone Weight II 欢迎关注H寻梦人公众号 You are given an array of integers stones where stones[i] is the we ...

  6. LeetCode 1049. Last Stone Weight II

    原题链接在这里:https://leetcode.com/problems/last-stone-weight-ii/ 题目: We have a collection of rocks, each ...

  7. LeetCode 1140. Stone Game II

    原题链接在这里:https://leetcode.com/problems/stone-game-ii/ 题目: Alex and Lee continue their games with pile ...

  8. Stone Game II

    Description There is a stone game.At the beginning of the game the player picks n piles of stones in ...

  9. HDU 4388 Stone Game II 博弈论 找规律

    http://acm.hdu.edu.cn/showproblem.php?pid=4388 http://blog.csdn.net/y1196645376/article/details/5214 ...

随机推荐

  1. Ysoserial Commons Collections2分析

    Ysoserial Commons Collections2分析 About Commons Collections2 CC2与CC1不同在于CC2用的是Commons Collections4.0; ...

  2. Visual Studio Docker调试端口设置

    一.前言 在Visual Studio 调试程序时,Docker中的容器端口和主机端口映射随机生成,导致每次调试都需要修改前端API接口的地址 二.解决方案 1.修改Docker调试启动参数,找到启动 ...

  3. AT3950 [AGC022E] Median Replace

    题目传送门 Description 有一个长度为 \(n\) 的 \(01\) 串,里面有一些还没有确定,我们标记为 ? .可以进行若干次操作,每次操作可以把三个相邻的数替换成它们的中位数.问有多少种 ...

  4. Probius+Prometheus通过API集成POD监控

    上一篇文章Probius+Kubernetes任务系统如虎添翼讲了我们把Kubernetes集成进了任务系统Probius,上线后小伙伴反馈虽然摆脱了Kubernetes-Dashboard,但还是得 ...

  5. 内网渗透DC-3靶场通关

    个人博客:点我 DC系列共9个靶场,本次来试玩一下DC-3,只有1个flag,下载地址. 下载下来后是 .ova 格式,建议使用vitualbox进行搭建,vmware可能存在兼容性问题.靶场推荐使用 ...

  6. Win10 配置JDK1.8 (JDK 8)环境变量

    JDK的安装: 1. JDK安装过程中,一般X掉公共JRE,因为JDK包含了JRE:     环境变量的配置: 1. 打开环境变量,编辑系统变量,新建: 变量名:JAVA_HOME 变量值:D:\so ...

  7. jquery-无缝滚动

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. 【UE4 设计模式】组件模式 Components Pattern

    概述 描述 在单一实体跨越了多个领域时,为了保持领域之间相互解耦,可以将每部分代码放入各自的组件类中,将实体简化为组件的容器. 套路 参考 UE4中的 Componet 组件使用方式 使用场景 有一个 ...

  9. Noip模拟84 2021.10.27

    以后估计都是用\(markdown\)来写了,可能风格会有变化 T1 宝藏 这两天老是会的题打不对,还是要细心... 考场上打的是维护\(set\)的做法,但是是最后才想出来的,没有维护对于是没有交. ...

  10. 关于下载pyton第三方库的细节

    1.下载Python第三方库有时候国外的网站网速很不好,需要选择国内的镜像网站去下载 阿里云 http://mirrors.aliyun.com/pypi/simple   中国科技大学 https: ...