摘要: 类似背包的简单dp,dp[i][j]表示枚举前i个数字的组合mod p的值为j的方法数,要求的答案即为dp[n][0]。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int MOD = 100000000... 阅读全文
posted @ 2015-09-19 23:06 hxy_has_been_used 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 因为xor具有前缀和性质,所以可以建立一颗二维树状数组,写起来只是稍微有点改变,感觉此题还是很不错的,结合了数据结构和博弈。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 501; 7 in... 阅读全文
posted @ 2015-09-19 23:01 hxy_has_been_used 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 中等递推题:ans[i] = ans[i - 2] + ans[i - 1] +( sum[i - 2] + cnt[i - 2] * len[i - 1] ) * cnt[i - 1] - sum[i - 1] * cnt[i - 2];其中,ans[i]代表答案,cnt[i]代表ith个mess... 阅读全文
posted @ 2015-09-19 18:56 hxy_has_been_used 阅读(284) 评论(0) 推荐(0) 编辑