[poj2311]Cutting Game_博弈论】的更多相关文章

Cutting Game poj-2311 题目大意:题目链接 注释:略. 想法: 我们发现一次操作就是将这个ICG对应游戏图上的一枚棋子变成两枚. 又因为SG定理的存在,记忆化搜索即可. 最后,附上丑陋的代码... ... #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define N 250 using namespace std; bool…
正解:博弈论 解题报告: 传送门! 首先看到说,谁先$balabala$,因为$SG$函数是无法解决这类问题的,于是考虑转化成"不能操作者赢/输"的问题,不难想到先剪出$1\cdot 1$一定是对手剪出了一个$1\cdot n$的格子,于是就变成,不能剪出$1\ x\ n$的格子,不能操作者败 然后就可以直接用$SG$函数,,,?就对于$n\cdot m$的一个局面,剪一道就相当于分成了$i\cdot m$,$(n-i)\cdot m$的两个子游戏(竖着剪差不多就先只讨论横着剪了昂$Q…
总时间限制: 1000ms 内存限制: 65536kB 描述 Urej loves to play various types of dull games. He usually asks other people to play with him. He says that playing those games can show his extraordinary wit. Recently Urej takes a great interest in a new game, and Eri…
由于异或运算满足结合律,我们把当前状态的SG函数定义为 它所能切割成的所有纸片对的两两异或和之外的最小非负整数. #include<cstdio> #include<set> #include<cstring> using namespace std; int n,m,SG[201][201]; int sg(int x,int y) { if(SG[x][y]!=-1) return SG[x][y]; set<int>S; for(int i=2;i&l…
Cutting Game Description Urej loves to play various types of dull games. He usually asks other people to play with him. He says that playing those games can show his extraordinary wit. Recently Urej takes a great interest in a new game, and Erif Nezo…
题意 Language:Default Cutting Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6007 Accepted: 2190 Description Urej loves to play various types of dull games. He usually asks other people to play with him. He says that playing those game…
思路:求SG函数!! 代码如下: #include<iostream> #include<cstdio> #include<cmath> #include<cstring> using namespace std; ][]; int getsg(int m,int n) { ) return sg[m][n]; ]; memset(vis,,sizeof(vis)); ;i<=m/;i++) vis[getsg(i,n)^getsg(m-i,n)]=;…
A Chess Game poj-2425 题目大意:题目链接 注释:略. 想法:这个题就是为什么必须要用记忆化搜索.因为压根就不知道后继是谁. 我们通过SG定理可知:当前游戏的SG值等于所有子游戏的SG的异或和. 我们就可以dp了. 最后,附上丑陋的代码... ... #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define N 1010 in…
A mutiplication game poj-2505 题目大意:给定一个数n和p,两个选手每次可以将p乘上[2,9].最先使得p大于n的选手胜利. 注释:$1\le n\le 4294967295$,$p=1$. 想法: 这个题比较新颖,我们可以直接推出必败态区间. 最后,附上丑陋的代码... ... #include <iostream> #include <cstdio> #include <cstring> #include <algorithm>…
Matches Game poj-2234 题目大意:n堆石子的Nim游戏,anti-SG. 注释:$1\le n\le 20$. 想法:用Colon定理即可.具体见:小约翰的游戏 最后,附上丑陋的代码... ... #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int main() { int n; whi…