【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 ...
随机推荐
- poj1862 Stripies
思路: 简单贪心. 实现: #include <iostream> #include <cstdio> #include <algorithm> #include ...
- #pragma使用分析
#pragma简介 #pragma用于指示编译器完成一些特定的动作 #pragma所定义的很多指示字是编译器特有的 #pragma在不同的编译器间是不可移植的 预处理器将忽略它不认识的#pragma指 ...
- B/S网络架构
B/S基于统一的应用层协议HTTP来交互数据,目前的B/S网络架构大多采用如图所示的架构设计,既要满足海量用户访问请求,又要保持用户请求的快速响应. 当一个用户在浏览器输入www.taobao.com ...
- $("xxx").attr添加属性的时候不好用
今天在工作中碰到了使用$(this).attr("selected","selected")为option属性添加默认值时发现时而好用 时而不好用,后经百度发现 ...
- 第一次提交代码到github时经常遇到的问题
最近两年在OpenStack方面做了一些工作,写了一些实验性的plugin. 本着Open Source的共享精神,想尝试提交到github,以便他人能下载使用. 当你注册完github帐号之后,点击 ...
- 【HEVC帧间预测论文】P1.7 Content Based Hierarchical Fast Coding Unit Decision Algorithm
Content Based Hierarchical Fast Coding Unit Decision Algorithm For HEVC <HEVC标准介绍.HEVC帧间预测论文笔记> ...
- Asp.Net Core 入门(一)——Program.cs做了什么
ASP.NET Core 是微软推出的一种全新的跨平台开源 .NET 框架,用于在 Windows.Mac 或 Linux 上生成基于云的新式 Web 应用程序.国内目前关于Asp.Net Core的 ...
- url跳转路径参数获取
function getUrlParam1(name){ //正则表达式过滤 var reg = new RegExp("(^|&)" + name + "=([ ...
- Abaqus用户子程序umat的学习
Abaqus用户子程序umat的学习 说明:在文件中,!后面的内容为注释内容.本文为学习心得,很多注释是自己摸索得到.如有不正确的地方,敬请指正. ! ------------------------ ...
- codevs 2853 方格游戏--棋盘dp
方格游戏:http://codevs.cn/problem/2853/ 这和传纸条和noip方格取数这两个题有一定的相似性,当第一眼看到的时候我们就会想到设计$dp[i][j][k][l]$(i,j表 ...