uva 11386 Triples 这题 应该用 hash , 用 STL map超时,但是我自己手写二分,再加一些优化,限时8秒,我7.8秒卡过,很爽!
这题弹了很多遍,注意的是,ans 用int 不够,最后直接改为long long 就过了,因为这题数据没说范围,只说了是正整数,所以有点不爽啊。。。但是,ans可以算出来绝对超过 int 的 ,因为最多5000个数,如果有1000个1 1000个2 3000个3 答案就是 3e9 超过int 了
#include
#include
#include