摘要: 这题和博弈有关。dp[]储存结果,0表示后取胜,1表示先取胜,而dp[i]取决于它的“前驱”。举个例子吧,可取的石子数为1,3,8,则19的前驱为18、16、11,如果这个状态都为1,那么19的状态为0;只要有一个为0,19的状态就是1。其实我写的代码是有问题的,可能会导致溢出,可是A了,说明UVA的测试数据还不够大吧。 1 #include <stdio.h> 2 #include <string.h> 3 #define MAXN 1000005 4 bool dp[MAXN]; 5 int a[12]; 6 int main() 7 { 8 int n,m,i,j 阅读全文