博弈 HDOJ 4371 Alice and Bob】的更多相关文章

题目传送门 题意:Alice和 Bob轮流写数字,假设第 i 次的数字是S[i] ,那么第 i+1 次的数字 S[i+1] = S[i] + d[k] 或 S[i] - d[k],条件是 S[i+1] <= n && S[i-1]<S[i+1] 分析:设d[]最小的数字为mn,除此之外设为d,第一次A写了0,第二次B如果写了d,那么A可以写d - mn,确保自己有数直到胜利:如果B第一次写了mn,那么以后的数都只能加mn直到>n,这个很好判断谁胜利. 收获:博弈题想到了就…
Alice and Bob Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB Total submit users: 20, Accepted users: 10 Problem 11499 : No special judgement Problem description Alice and Bob are interested in playing games. One day, they invent…
Foj 2296 Alice and Bob 题意 两个人博弈,规则如下:轮流取0~9中的数字,最后Alice所得的数字个数为1~n中,数位在Alice所取集合中出现奇数次的. 双方想获得尽量多,问Alice能获得几个. 题解 观察一下,如果n是十的倍数,最后肯定是一人一半,这样一来,状态数应该会减少很多,我们就可以直接去搜. 半个月前我补这道题,一直觉得是个dp问题,现在想想,其实就是暴力去做极大极小过程,只是需要把状态数表示出来. 因为有了一开始的观察,所以可以把数字分成四类,再记一下前几位…
Alice and Bob Time Limit:3000MS     Memory Limit:128000KB     64bit IO Format:%lld & %llu Submit Status Practice ACdream 1112 Description Here  is Alice and Bob again ! Alice and Bob are playing a game. There are several numbers. First, Alice choose…
A Game Between Alice and Bob Time Limit: 5 Seconds      Memory Limit: 262144 KB Alice and Bob play the following game. A series of numbers is written on the blackboard. Alice and Bob take turns choosing one of the numbers, and replace it with one of…
Alice and Bob Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 147    Accepted Submission(s): 22 Problem Description As you know, Alice and Bob always play game together, and today they get a…
原题: ZOJ 3666 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3666 博弈问题. 题意:给你1~N个位置,N是最终点,1~N-1中某些格子能够移石头到另外一些指定的格子,1~N-1上有M个石头,位置不定,现在Alice和Bob要把这些石头全部移到N点,谁不能移则输,问先手必胜还是后手必胜. 做法:求出每个位置的SG函数值,然后将放石头的M个位置的SG函数值做异或,异或为0则Alice赢.这里讲坐标反转,1~N…
我之前做过一些博弈的题目,以为博弈都是DP,结果被坑了很多次,其实博弈有很多种,在此,把我见过的类型都搬上来. 1,HDU3951(找规律) 题意:把n枚硬币围成一个圆,让Alice和Bob两个人分别每人每次拿k(1<=k<=m)枚连续的硬币,谁能拿到最后谁赢: 思路:找规律,A拿了之后,B只要把剩下的分成偶数块,B就能赢,找到的规律就是除了m=1 && n&1是A赢,其余全是B赢,即B能够分成偶数块: #include <cstdio> #include…
Alice and Bob Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1130 Accepted Submission(s): 407 Problem Description Alice and Bob are very smart guys and they like to play all kinds of games in the…
Problem Description The famous "Alice and Bob" are playing a game again. So now comes the new problem which need a person smart as you to decide the winner. The problem is as follows: They are playing on a rectangle paper, Alice and Bob take tur…