hdu4764 Stone 博弈】的更多相关文章

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4764 很水的博弈题目 代码: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdlib> #include<cstdio> using namespace std; int n,k; int main() { ) { && k == )break; )%(k+…
题目链接:hdu 5996 dingyeye loves stone 题意: 给你一棵树,树的每一个节点有a[i]个石子,每个人可以将这个节点的石子移向它的父亲,如果没有合法操作,那么就算输,现在给你当前的局面,问你能否赢 题解: 设根节点的深度为0,将所有深度为奇数的节点的石子数目xor起来,则先手必胜当且仅当这个xor和不为0. 证明同阶梯博弈.对于偶深度的点上的石子,若对手移动它们,则可模仿操作:对于奇深度上的石子,移动一次即进入偶深度的点. 时空复杂度O(n). #include<bit…
hdu4764bash博弈主要是找准必胜状态,以及好好理解题意.这里的必胜状态是n-1,虽然是写的数比上一个大1到k,但是相当于这个人拿1到k,然后是累加的效果 #include<iostream> #include<cstdio> #include<queue> #include<algorithm> #include<cmath> #include<ctime> #include<set> #include<ma…
A New Stone Game Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5338   Accepted: 2926 Description Alice and Bob decide to play a new stone game.At the beginning of the game they pick n(1<=n<=10) piles of stones in a line. Alice and Bob…
Stone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 179    Accepted Submission(s): 137 Problem Description Tang and Jiang are good friends. To decide whose treat it is for dinner, they are pla…
Stone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2204    Accepted Submission(s): 1553 Problem Description Tang and Jiang are good friends. To decide whose treat it is for dinner, they are p…
Description The funny stone game is coming. There are n piles of stones, numbered with 0, 1, 2,..., n - 1. Two persons pick stones in turn. In every turn, each person selects three piles of stones numbered i, j, k (i < j, jk and at least one stone le…
先是题目,本来是第三次训练的题,在这特别提出来讲. 先是题目: E - A simple stone game Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit   Status   Practice   POJ 3922 Description After he has learned how to play Nim game, Mike begins to try anoth…
F - Again Stone Game Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Description Alice and Bob are playing a stone game. Initially there are n piles of stones and each pile contains some stone. Alice stars the…
http://acm.hdu.edu.cn/showproblem.php?pid=5996 题意:在一棵树上进行博弈,每次只能将当前的结点的石子放到父节点上,最后不能移动的输. 思路:比赛的时候想的是对于每一个深度为dep的结点,可以转化为dep堆同样的深度为1的结点,然后就不会了,忘了最后异或起来偶数可以抵消,相当于对方移动,我方也跟着移动对方上一个回合移动的石子,所以最后只要考虑深度为奇数的结点. #include <cstdio> #include <algorithm>…