【HDOJ6324】Grab The Tree(博弈)
题意:
思路:

#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string.h>
#include <limits.h>
#include <string>
#include <iostream>
#include <queue>
#include <math.h>
#include <stack>
#include <map>
#define left (now<<1)
#define right ((now<<1)+1)
#define mid ((l+r)>>1)
using namespace std;
typedef long long int lint; const int MAXN = 1e5 + ; int t,n,m;
int p[]; void chai(int num){
for(int i = ; i <= ; ++i){
int k = num & ;
num = num >> ;
if(k == ){ p[i]++;}
}
} int main(){
scanf("%d",&t);
while(t--){
scanf("%d",&n); memset(p,,sizeof(p));
for(int i = ; i <= n; ++i){
int num; scanf("%d",&num); chai(num);
}
for(int i = ; i < n; ++i){
int u,v; scanf("%d%d",&u,&v);
}
int can = -;;
for(int i = ; i >= ; --i){
if(p[i] % == ){
can = ; break;
}
}
// for(int i = 0; i <= 4; ++i){
// printf("%d ",p[i]);
// }
if(can == -){
printf("D\n");
}else{
printf("Q\n");
}
}
return ;
}
【HDOJ6324】Grab The Tree(博弈)的更多相关文章
- 2018 Multi-University Training Contest 3 Problem F. Grab The Tree 【YY+BFS】
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6324 Problem F. Grab The Tree Time Limit: 2000/1000 MS ...
- 2018HDU多校训练-3-Problem F. Grab The Tree
Little Q and Little T are playing a game on a tree. There are n vertices on the tree, labeled by 1,2 ...
- AtCoder Grand Contest 017D (AGC017D) Game on Tree 博弈
原文链接https://www.cnblogs.com/zhouzhendong/p/AGC017D.html 题目传送门 - AGC017D 题意 给定一棵 n 个节点的以节点 1 为根的树. 两个 ...
- Problem F. Grab The Tree HDU - 6324
题意:给出一棵n个节点的树,每个节点有一个权值,Q和T玩游戏,Q先选一些不相邻的节点,T选剩下的节点,每个人的分数是所选节点的权值的异或和,权值大的胜出,问胜出的是谁. 题解: 话说,这题后面的边跟解 ...
- HDU 6324.Problem F. Grab The Tree-博弈(思维) (2018 Multi-University Training Contest 3 1006)
6324.Problem F. Grab The Tree 题目看着好难,但是题解说的很简单,写出来也很简单.能想出来就是简单的,想不出来就难(讲道理,就算是1+1的题目,看不出来就是难的啊). 和后 ...
- 2018 Multi-University Training Contest 3
claris出题,orzzzzzz.前一天晚上说是贪心专场,喵喵喵??? 之前clsris说难题扔多校了,据说07,13是女生赛撤下来的题,喵喵喵??? A.Ascending Rating 题目传送 ...
- 2018 Multi-University Training Contest 3 - HDU Contest
题解: solution Code: A. Ascending Rating #include<cstdio> const int N=10000010; int T,n,m,k,P,Q, ...
- 2018 HDU多校第三场赛后补题
2018 HDU多校第三场赛后补题 从易到难来写吧,其中题意有些直接摘了Claris的,数据范围是就不标了. 如果需要可以去hdu题库里找.题号是6319 - 6331. L. Visual Cube ...
- 2018 Multi-University Training Contest 3 杭电多校第三场
躺了几天 终于记得来填坑了 1001 Ascending Rating (hdoj 6319) 链接:http://acm.hdu.edu.cn/showproblem.php?pid=6319 ...
随机推荐
- sql server 2012 从删库到跑路
问题: 向sql server 2012单个数据库中导入1500万+条数据的时候,报错: 错误 0xc0202009: 数据流任务 1: SSIS 错误代码 DTS_E_OLEDBERROR.出现 O ...
- Eclipse 闪退/无法启动/一闪而过打解决办法
解决方法 删除文件:/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi 经过实际应用真实有效.
- php中include_path配置
在php.ini中可配置include_path来达到在任何文件中都可以直接引入该目录下文件 include_path = ".:/usr/share/php:/var/www/phpxwl ...
- General mistakes in parallel computing
这是2013年写的一篇旧文,放在gegahost.net上面 http://raison.gegahost.net/?p=97 March 11, 2013 General mistakes in ...
- js里面Object的一些方法
1.Object.freeze() 阻止修改现有属性的特性和值,并阻止添加新属性两种用法:Object.freeze( { } ) 和 Object.freeze( object ) <scri ...
- 洛谷 P1011 车站
题目描述 火车从始发站(称为第1站)开出,在始发站上车的人数为a,然后到达第2站,在第2站有人上.下车,但上.下车的人数相同,因此在第2站开出时(即在到达第3站之前)车上的人数保持为a人.从第3站起( ...
- mysql 函数tree状
// 子节点的查询 CREATE DEFINER = `root`@`%` FUNCTION `getDeptChildList`(rootId BIGINT) RETURNS longtext DE ...
- 深入了解JVM(Java虚拟机)
虚拟机 JRE由Java API和JVM组成,JVM通过类加载器(Class Loader)加类Java应用,并通过Java API进行执行. 虚拟机(VM: Virtual Machine)是通过软 ...
- CAD交互绘制直线(网页版)
用户可以在CAD控件视区任意位置绘制直线. 主要用到函数说明: _DMxDrawX::DrawLine 绘制一个直线.详细说明如下: 参数 说明 DOUBLE dX1 直线的开始点x坐标 DOUBLE ...
- 一条update语句优化小记
遇到性能问题的sql如下: sql1: UPDATE amlclientlevel a SET a.client_value = (SELECT l.client_value ...