上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 28 下一页
摘要: 和上一个题基本一样。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 const int N = 101; 10 char maz... 阅读全文
posted @ 2015-08-14 15:22 hxy_has_been_used 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 对于这类需要钥匙才能通过的迷宫来说,一般visit数组会开成三维的:bool visit[N][N][1 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int N =... 阅读全文
posted @ 2015-08-14 14:31 hxy_has_been_used 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 很显然对于这个题来说,有的点可能需要重复走(比如旁边有Bomb-Reset-Equipment,可能你需要去一下再回来),所以标记每个点的时候应该记录访问该点时的剩余时间,如果下一次剩余时间更多则可以加入队列,否则的话加入这个点是没有意义的(因为花费的总步数更多但是剩余的时间没有变多)。 1 #in... 阅读全文
posted @ 2015-08-14 13:34 hxy_has_been_used 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 剪枝还是挺多的,不过都比较容易想,主要是复习一下奇偶性剪枝。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int N = 7; 8 char maze[N][N]; 9 int d... 阅读全文
posted @ 2015-08-14 10:01 hxy_has_been_used 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 想明白以后会发现其实就是模拟...因为每次只能给一整行或者一整列赋值,所以目标矩阵一开始一定有一行或者一列上数字都是相同的,找到对应的操作,把那一行或者那一列标记为访问过(即从原矩阵中删除)。然后新的矩阵也一定能找到一行或者一列数字都相同,再找到相应的操作,标记那一行或者那一列,依次类推,然后没有用... 阅读全文
posted @ 2015-08-13 20:17 hxy_has_been_used 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 类似于背包,dp[i]表示选出一些数它们的“根”是i的方法数(包括了所有人的“根”是i的情况)。然后就是要注意所有人都走另一个门的情况。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int MOD = 2... 阅读全文
posted @ 2015-08-13 19:10 hxy_has_been_used 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 这个游戏叫做斐波那契博弈,顾名思义,当n是斐波那契数的时候必败,其他情况必胜。证明见:http://blog.csdn.net/acm_cxlove/article/details/7835016 1 #include 2 using namespace std; 3 4 const int N... 阅读全文
posted @ 2015-08-13 09:16 hxy_has_been_used 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 状态比较少,考虑回溯。如果当前sum大于31则为必胜态(因为上一个人没有合法操作),然后就是:如果存在一种方法使得对手败则自己必胜;否则的话自己无论怎样操作都会导致对手赢则自己必败。 1 #include 2 #include 3 #include 4 using namespace std;... 阅读全文
posted @ 2015-08-12 20:35 hxy_has_been_used 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 简单模拟题,可以利用一下能被11整除的数的特点:奇数位的数字和与偶数位的数字和之差能被11整除。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int N = 1000000; 8 ... 阅读全文
posted @ 2015-08-11 19:49 hxy_has_been_used 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 容易联想到利用manacher算法获得len数组,然后枚举第二段的长度判断能否和第三段对应上,能的话就更新答案。另外枚举长度的时候,小于等于当前答案的长度就没有必要枚举了,不然可能会超时。 1 #include 2 #include 3 #include 4 using namespace s... 阅读全文
posted @ 2015-08-11 18:47 hxy_has_been_used 阅读(384) 评论(3) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 28 下一页