题意:有N个数,Alice 和 Bob 轮流对这些数进行操作,若一个数 n=a*b且a>1,b>1,可以将该数变成 a 和 b 两个数: 或者可以减少为a或b,Alice先,问谁能赢 思路:首先单看对每个数进行除法的操作,我们可以知道其实是在除以每个数的素因子或素因子之间的积 比如 70=2*5*7 我们可以变成 10(2*5)或 14(2*7) 或 35(5*7)或 2 或 5 或 7 或 1 这七种状态 当我们把他们(2,5,7)当作3个石子也就是一堆时,然而实际上我们是将这堆石子进行ni…
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…
原题: 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…
题目链接:传送门 游戏规则: 没次能够将一堆分成两堆 x = a*b (a!=1&&b!=1)x为原来堆的个数,a,b为新堆的个数. 也能够将原来的堆的个数变成原来堆的约数y.y!=x.进行最后一次操作的人获胜. 分析: 也是一个去石头的游戏,因此我们仅仅须要将全部情况的sg值异或起来就好了. 我们首先来考虑一堆.设这一堆的个数为x: 那么全部的情况就是 (a1,x/a1), (a2,x/a2),...,(an,x/an);或者(a1),(a2),..,(an). 由于数据量比較大,我们朴…
Nim is a two-player mathematic game of strategy in which players take turns removing objects from distinct heaps. On each turn, a player must remove at least one object, and may remove any number of objects provided they all come from the same heap.…
Nim or not Nim? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1056    Accepted Submission(s): 523 Problem Description Nim is a two-player mathematic game of strategy in which players take turn…
题意:http://acdream.info/problem?pid=1112 Problem Description Here  is Alice and Bob again ! Alice and Bob are playing a game. There are several numbers.First, Alice choose a number n.Then he can replace n (n > 1)with one of its positive factor but not…
uoj266[清华集训2016]Alice和Bob又在玩游戏(SG函数) uoj 题解时间 考虑如何求出每棵树(子树)的 $ SG $ . 众所周知一个状态的 $ SG $ 是其后继的 $ mex $ . 考虑其后继的 $ SG $ 如何求. 对于将 $ y $ 的贡献计算到其父亲 $ x $ 上. 如果删掉 $ x $ ,后继状态是所有儿子的 $ SG $ 异或, 如果删掉 $ y $ 以内的点,则是用 $ y $ 子树内的所有后继状态异或上 $ x $ 子树内 $ y $ 子树外的部分. 这…
ZOJ 3529 - A Game Between Alice and Bob Time Limit:5000MS     Memory Limit:262144KB     64bit IO Format:%lld & %llu Description Alice and Bob play the following game. A series of numbers is written on the blackboard. Alice and Bob take turns choosing…
Alice and Bob are very smart guys and they like to play all kinds of games in their spare time. The most amazing thing is that they always find the best strategy, and that's why they feel bored again and again. They just invented a new game, as they…