
哈希
m悟空
这个作者很懒,什么都没留下…
展开
-
A + B for you again(两个字符串拼接--第一个的后缀与第二个前缀相等时省略一个)
Generally speaking, there are a lot of problems about strings processing. Now you encounter another such problem. If you get two strings, such as “asdf” and “sdfg”, the result of the addition between ...原创 2018-12-13 17:47:02 · 868 阅读 · 0 评论 -
小Hi和小Ho的礼物 (哈希记和 + 容斥)
某人有N袋金币,其中第i袋内金币的数量是Ai。现在他决定选出2袋金币送给小Hi,再选2袋金币送给小Ho,同时使得小Hi和小Ho得到的金币总数相等。他想知道一共有多少种不同的选择方法。 具体来说,有多少种下标四元组(i, j, p, q)满足i, j, p, q两两不同,并且i < j, p < q, Ai+ Aj= Ap+ Aq。 例如对于数组A=[1, 1, 2, 2, ...原创 2019-03-16 19:57:38 · 300 阅读 · 0 评论