摘要: 先暴力出sg函数来,会发现sg(x) = x,然后枚举每一种走法,看看异或结果是否为0。因为temp^temp = 0,所以这样可以直接判断。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 using namespace std; 6 int n; 7 int p[101]; 8 int main() 9 {10 int i,temp,ans,num;11 while(scanf("%d",& 阅读全文
posted @ 2013-05-28 20:55 Naix_x 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 这个题和传纸条差不多,但是我没想到。。还是在解决只走一次时候,没想到怎么办。dp[i][j]代表一条走到i和另一条走到j的最多结点。假如某点走了两次那么他一定是从dp[i][i]走来的,但是dp[i][i] = 0,所以根本没有这种情况。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: tour 5 */ 6 #include <iostream> 7 #include <cstdio> 8 #include <cstring> 9 #include <algorithm>10 #include <map> 阅读全文
posted @ 2013-05-28 19:54 Naix_x 阅读(237) 评论(0) 推荐(0) 编辑
摘要: SG函数模版,学习ing... 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 using namespace std; 6 int dp[10001],n; 7 int p[101]; 8 int sg(int x) 9 {10 int i;11 int flag[101];12 memset(flag,0,sizeof(flag));13 if(dp[x] != -1)14 return dp[x];15 if(x 阅读全文
posted @ 2013-05-28 10:36 Naix_x 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 打表水过。看的题解,置换的那个优化完全没有看懂。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: latin 5 */ 6 #include <cstdio> 7 #include <iostream> 8 using namespace std; 9 int r[11][11],c[11][11];10 int ans,n;11 void dfs(int x,int y)12 {13 int xx,yy,i;14 if(x > n-1)15 {16 ans ++;17 return ;18 }19 ... 阅读全文
posted @ 2013-05-28 08:46 Naix_x 阅读(447) 评论(0) 推荐(0) 编辑