上一页 1 2 3 4 5 6 7 8 ··· 15 下一页
摘要: 【题意】给定n个数的数组A和数组B,求所有A[i]+B[j]的异或和(1<=i,j<=n)。n<=200000。 【算法】二分+模拟 【题解】将答案分成(A[i]+B[j]-A[i]^B[j])的异或和 以及 A[i]^B[j]的异或和,即单独考虑进位(后面部分很好算)。 二进制题目必须拆位,通过进 阅读全文
posted @ 2018-03-18 12:26 xianbeigg 阅读(219) 评论(0) 推荐(0) 编辑
摘要: Object []kk=set.toArray(); Arrays.sort(kk); 阅读全文
posted @ 2018-03-16 15:49 xianbeigg 阅读(105) 评论(0) 推荐(0) 编辑
摘要: java: 注意:Java中的优先队列没有排序功能,若要排序,请用: As you can see in the PriorityQueue javadoc: The Iterator provided in method iterator() is not guaranteed to traver 阅读全文
posted @ 2018-03-16 11:06 xianbeigg 阅读(236) 评论(0) 推荐(0) 编辑
摘要: The functions associated with priority queue are:empty() – Returns whether the queue is emptysize() – Returns the size of the queuetop() – Returns a r 阅读全文
posted @ 2018-03-16 10:50 xianbeigg 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Problem Statement Each card must be used in exactly one of the palindromes. The total number of palindromes must be as small as possible. Definition L 阅读全文
posted @ 2018-03-14 17:08 xianbeigg 阅读(165) 评论(0) 推荐(0) 编辑
摘要: if(a&1) 表示if(a%2==1) 即判断a的最低为是否为1 阅读全文
posted @ 2018-03-14 16:56 xianbeigg 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 如果先插入相等的再判断不等的,换一下顺序,竟然出错了,不解,换过来就AC了 阅读全文
posted @ 2018-03-14 16:11 xianbeigg 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 【题目】 正常的表达式称为中缀表达式,运算符在中间,主要是给人阅读的,机器求解并不方便。 例如:3 + 5 * (2 + 6) - 1 而且,常常需要用括号来改变运算次序。 相反,如果使用逆波兰表达式(前缀表达式)表示,上面的算式则表示为: - + 3 * 5 + 2 6 1 不再需要括号,机器可以 阅读全文
posted @ 2018-03-14 15:18 xianbeigg 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 题目】 考古发现某古墓石碑上刻着一个数字:13597,后研究发现: 这是一个素数! 并且,去掉首尾数字仍是素数! 并且,最中间的数字也是素数! 这样特征的数字还有哪些呢?通过以下程序的帮助可以轻松解决。 请仔细阅读代码,并填写划线部分缺失的代码。 阅读全文
posted @ 2018-03-14 11:55 xianbeigg 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 暴力: dfs: 阅读全文
posted @ 2018-03-14 11:36 xianbeigg 阅读(175) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 15 下一页