标签 - SG函数

? 解题记录 ? ? HDU ? ? 博弈论 ? ? SG函数 ?    2018-04-03 19:55:34    321    0    0
  Problem Description Alice and Bob want to play an interesting game on a tree.Given is a tree on N vertices, The vertices are numbered from 1 to N. vertex 1 represents the root. There are N-1 edges. Players alternate in making moves, Alice moves first. A move consists of two steps. In the firs
? 解题记录 ? ? 博弈论 ? ? SG函数 ? ? VIJOS ?    2018-01-28 12:10:13    340    0    0
背景用糖果来引诱小朋友学习是最常用的手法,绵羊爸爸就是用糖果来引诱萌萌学习博弈的。 描述他把糖果分成了两堆,一堆有A粒,另一堆有B粒。他让萌萌和他一起按照下面的规则取糖果:每次可以任意拿走其中一堆糖果;如果这时候另一堆糖果数目多于1粒,就把它任意分成两堆,否则就把剩下的一粒糖果取走并获得这次博弈的胜利。胜利者将获得所有的糖果。萌萌想要得到所有的糖果,而绵羊爸爸想把糖果留下以便下一次利用。现在由萌萌先取糖果,旁观的小朋友们想知道萌萌是否有必胜策略。 格式输入格式本题有多组测试数据(不超过100组)。每组数据包括两行,第一行为A,第二行为B。1 ≤ A,B ≤ 2^127。输入数据以一个 -1 结