Candy Distribution 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5291 Description WY has n kind of candy, number 1-N, The i-th kind of candy has ai. WY would like to give some of the candy to his teammate Ecry and lasten. To be fair, he hopes that…
主要讲第五课的内容前缀树应用和第六课内容暴力递归改动态规划的最全步骤 第一题 给定一个数组,求子数组的最大异或和. 一个数组的异或和为,数组中所有的数异或起来的结果. 简单的前缀树应用 暴力方法: 先计算必须以i结尾的子数组的异或和,然后再计算机i+1的,以此类推... 最暴力的解 public static int getMaxEor1(int[] nums) { int maxEor = Integer.MAX_VALUE; for (int i = 0; i < nums.length;…
Two 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5791 Description Alice gets two sequences A and B. A easy problem comes. How many pair of sequence A' and sequence B' are same. For example, {1,2} and {1,2} are same. {1,2,4} and {1,4,2} are not sam…