URAL 2068 Game of Nuts (博弈)】的更多相关文章

题意:给定 n 堆石子,每次一个人把它们分成三堆都是奇数的,谁先不能分,谁输. 析:因为每堆都是奇数,那么最后肯定都是要分成1的,那么就把不是1的全加和,然后判断奇偶就OK了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath>…
2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in process, manpower and supplies are coming to an end and the winter is as near as never before. The game of thrones is unpredictable so Daenerys and Stannis…
1.题目描述: 2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in process, manpower and supplies are coming to an end and the winter is as near as never before. The game of thrones is unpredictable so Daenerys and…
http://poj.org/problem?id=2068 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ][(<<)+];//dp[i][j]表示轮到第i个人取时,剩j个石头 ]; int DFS(int pos,int remain) { ) return dp[pos][remain];//记忆化…
1180. Stone Game Time limit: 1.0 second Memory limit: 64 MB Two Nikifors play a funny game. There is a heap of N stones in front of them. Both Nikifors in turns take some stones from the heap. One may take any number of stones with the only condition…
题目大意: 有2n个人,从0开始编号,按编号奇偶分为两队,循环轮流取一堆有m个石子的石堆,偶数队先手,每个人至少取1个,至多取w[i]个,取走最后一个石子的队伍输.问偶数队是否能赢. 分析: 题目数据不大很容易就可以联想到DP博弈,设dp[i][j]表示轮到第i个人,还有j个石子的情况下他所属队伍是否能赢. 那么如果存在一个x,使第i个人取了x个石子后第(i+1)%2n个人无论如何都败,那么他就可以赢:若不存在则输.即是: dp[i][j]=(dp[(i+1)%2n][j-1]&dp[(i+1)…
Nim Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1403   Accepted: 791 Description Let's play a traditional game Nim. You and I are seated across a table and we have a hundred stones on the table (we know the number of stones exactly).…
Two students are playing the following game. There are 2· n points on the plane, given with their coordinates ( xi,  yi). Each move player paints the point with his own color (first with white, second with black). The first student makes odd moves, s…
POJ 上的一套水题,哈哈~~~,最后一题很恶心,不想写了~~~ Rope Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7410   Accepted: 2603 Description Plotters have barberically hammered N nails into an innocent plane shape, so that one can see now only heads. Moreove…
There is a strip 1 × n with two sides. Each square of the strip (their total amount is 2n, n squares on each side) is painted in one of two colors (let’s call them A and B). Alice and Bob play a game. Alice makes the first turn. On each turn, a playe…