HDU.1536.S-Nim(博弈论 Nim)】的更多相关文章

http://acm.hdu.edu.cn/showproblem.php?pid=3404 题目 http://www.doc88.com/p-5098170314707.html 论文 nim积在22页附近 http://blog.csdn.net/kele52he/article/details/77099890 抄的代码的来源 根据论文相关部分和自己的理解的介绍.(nim积其实没什么卵用,学这种毒瘤的都有猫病.) nim和其实就是异或,想一下之前sg函数或者nim游戏结算的时候,是几堆在…
基本的树上删边游戏 写过很多遍了 /** @Date : 2017-10-13 18:19:37 * @FileName: HDU 3094 树上删边 NIM变形.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : $Id$ */ #include <bits/stdc++.h> #define LL long long #d…
http://poj.org/problem?id=3533 变成三维的nim积..前面hdu那个算二维nim积的题的函数都不用改,多nim积一次就过了...longlong似乎不必要但是还是加上了 代码 #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<iostream> #include<map> #include<…
最近补上次参加2019西安邀请赛的题,其中的E题出现了Nim博弈论,今天打算好好看看Nim博弈论,在网上看到这篇总结得超级好的博客,就转载了过来. 转载:https://www.cnblogs.com/exponent/articles/2141477.html Nim游戏的概述: 还记得这个游戏吗?给出n列珍珠,两人轮流取珍珠,每次在某一列中取至少1颗珍珠,但不能在两列中取.最后拿光珍珠的人输.后来,在一份资料上看到,这种游戏称为“拈(Nim)”.据说,它源自中国,经由被贩卖到美洲的奴工们外传…
S-Nim HDU 1536 博弈 sg函数 题意 首先输入K,表示一个集合的大小,之后输入集合,表示对于这对石子只能去这个集合中的元素的个数,之后输入 一个m表示接下来对于这个集合要进行m次询问,之后m行,每行输入一个n表示有n个堆,每堆有n1个石子,问这一行所表示的状态是赢还是输,如果赢输入W否则L. 解题思路 如果没有每次取石子个数的限制的话,那么仅仅需要把每堆石子的个数进行异或运算即可,如果结果不是1,那么先手赢,反之后手赢. 但是这里对每次取石子的个数进行了限制,每次只能从几个数中进行…
HDU.2149 Public Sale (博弈论 巴什博弈) 题意分析 巴什博奕裸题 博弈论快速入门 代码总览 #include <bits/stdc++.h> using namespace std; int main() { int n,m,s,r; while(scanf("%d %d",&m,&n) != EOF){ s = m%(n+1); if(s == 0) printf("none\n"); else{ r = (m -…
HDU.1846 Brave Game (博弈论 巴什博弈) 题意分析 巴什博奕裸题 博弈论快速入门 代码总览 include <bits/stdc++.h> using namespace std; int main() { int t; scanf("%d",&t); while(t--){ int n,m; scanf("%d %d",&n,&m); int r,s; r = n%(m+1); if(r == 0) prin…
Alice and Bob are playing game of Misère Nim. Misère Nim is a game playing on k piles of stones, each pile containing one or more stones. The players alternate turns and in each turn a player can select one of the piles and can remove as many stones…
题目链接 \(Description\) 给定一个集合S,每次只能拿S中某个元素个数的石子.每组数据有多组询问,询问给出m堆石子个数,问先手是否必胜.有多组数据. 1. 首先对操作数组排个序,再预处理求sg就好了. //530MS 1544K #include <cstdio> #include <cctype> #include <cstring> #include <algorithm> #define gc() getchar() const int…
 这题是Lasker’s Nim. Clearly the Sprague-Grundy function for the one-pile game satisfies g(0) = 0 and g(1) = 1. The followers of 2 are 0, 1 and (1,1), with respective Sprague-Grundy values of 0, 1, and 1⊕1 = 0. Hence, g(2) = 2. The followers of 3 are 0,…