随笔分类 -  DFS

摘要:这道题是对SG函数的考查#include <iostream>#include <stdio.h>#include <string>#include <string.h>#include <algorithm>#include <math.h>#include <vector>#include <map>#include <queue>#include <stack>#include <stdlib.h>using namespace std;const int 阅读全文
posted @ 2013-05-17 10:42 Roly Yu 阅读(165) 评论(0) 推荐(0)
摘要:/* 对于小数据用这dfs,大数据就用递推的思想。*/#include <iostream>#include <stdio.h>#include <string>#include <string.h>#include <algorithm>#include <math.h>#include <queue>#include <map>#include <stack>#include <vector>using namespace std ;const int maxn = 20 阅读全文
posted @ 2013-05-14 15:13 Roly Yu 阅读(198) 评论(0) 推荐(0)
摘要:#include <iostream>#include <stdio.h>#include <string>#include <string.h>#include <algorithm>#include <math.h>#include <fstream>#include <vector>#include <map>#include <queue>#include <stack>#include <math.h>#include <stdlib. 阅读全文
posted @ 2013-05-07 15:16 Roly Yu 阅读(191) 评论(0) 推荐(0)
摘要:#include <iostream>#include <stdio.h>#include <string>#include <string.h>#include <algorithm>#include <math.h>#include <fstream>#include <vector>#include <map>#include <queue>#include <stack>#include <math.h>#include <stdlib. 阅读全文
posted @ 2013-05-07 09:21 Roly Yu 阅读(163) 评论(0) 推荐(0)
摘要:剪枝很重要,可走的格数小于时间则减去,然后就是奇偶性剪枝可以把map看成这样: 0 1 0 1 0 1 1 0 1 0 1 0 0 1 0 1 0 1 1 0 1 0 1 0 0 1 0 1 0 1 从为 0 的格子走一步,必然走向为 1 的格子 从为 1 的格子走一步,必然走向为 0 的格子 即: 0 ->1或1->0 必然是奇数步 0->0 走1->1 必然是偶数步 所以当遇到从 0 走向 0 但是要求时间是奇数的,或者, 从 1 走向 0 但是要求时间是偶数的 都可以直接判断不可达!#include <iostream>#include <std 阅读全文
posted @ 2013-05-03 16:50 Roly Yu 阅读(173) 评论(0) 推荐(0)