摘要: 题目:http://codeforces.com/contest/862/problem/C 题意:构造n个数字 使这些数字异或值为m 题解:从0开始,每连续4个数字数字xor值为0 则可以减少为4种情况。因为不同的两个数字异或不可能为0,所以m为0单独讨论。(忽略代码的丑陋) 阅读全文
posted @ 2017-09-20 20:34 Meternal 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 转自:https://answers.microsoft.com/zh-hans/windows/forum/apps_windows_10-outlook_mail/%E5%9B%BD%E5%86%85gmail%E4%B8%8D%E8%83%BD%E8%AE%BF/505fe237-cc7e-4 阅读全文
posted @ 2017-09-11 20:10 Meternal 阅读(1164) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://codeforces.com/contest/839/problem/D Examples input 33 3 1 output 12 input 42 3 4 6 output 39 Note In the first sample the clans are {1}, { 阅读全文
posted @ 2017-08-17 13:20 Meternal 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://codeforces.com/contest/787/problem/C 题意:一个长度为n的环,两个人公平游戏,先走到0点胜利,询问每个人从每个点开始的结果。 题解:利用一个人的必败态推另一个人的必胜态,用一个人的必胜态减少另一个人胜利的方案数。用bfs,反向往回推结果,fr 阅读全文
posted @ 2017-07-07 20:11 Meternal 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://codeforces.com/contest/822/problem/C 题意:找两端互不相交的线段长度和为x 使cost最小 直接排序后二分搜对应的长度内的最小值。也可以边查询边更新对应长度最小值,复杂度相同。代码如下: 阅读全文
posted @ 2017-07-07 10:08 Meternal 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://codeforces.com/contest/822/problem/D 题意:求${t^0}f(l) + {t^1}f(l + 1) + ... + {t^{r - l}}f(r)$ f(x)代表每次把x个人分成人数相等的若干个组进行比赛,每组有一个胜利的情况下,最后淘汰到只 阅读全文
posted @ 2017-07-07 09:48 Meternal 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 题意:从1到n+m的数组中选m个数字且每个数字和在原数组中下标不同,求方案数。例如 n=1 m = 2 则存在{2,1},{2,3},{3,1} 题解:错排问题模板 下面是使用容斥原理推导的过程 1. 先推导标准的错排公式 假设为从1到m的m个数字组成的数组 令k=非错排的数字个数 共有m!种情况, 阅读全文
posted @ 2017-07-02 14:20 Meternal 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://arc076.contest.atcoder.jp/tasks/arc076_c Sample Input 1 4 2 3 0 1 3 1 1 1 4 1 2 0 2 2 Sample Input 1 Sample Output 1 YES Sample Output 1 题意 阅读全文
posted @ 2017-06-25 04:22 Meternal 阅读(538) 评论(0) 推荐(0) 编辑
摘要: 传送门:http://arc076.contest.atcoder.jp/tasks/arc076_b Sample Input 1 3 1 5 3 9 7 8 Sample Input 1 Sample Output 1 3 Sample Input 2 6 8 3 4 9 12 19 18 1 阅读全文
posted @ 2017-06-24 23:08 Meternal 阅读(487) 评论(0) 推荐(0) 编辑
摘要: 传送门:https://www.nowcoder.com/activity/2017codem/oj 题解:dp,i代表a串开始的位置,j代表b串开始的位置,da,db分别代表在a和b中的长度,dp[x][y][z][h]代表 a中选下标为x到y-1的串 和 b中选z到h-1的串是否可以组合成回文串 阅读全文
posted @ 2017-06-22 13:22 Meternal 阅读(676) 评论(0) 推荐(0) 编辑