VisaOA #11
Count Triplets with Sum ≤ t
估计中等可在线判题
Given an array of distinct positive integers, count triplets with i<j<k whose sum is ≤t.
输入格式
n,t (3≤n≤2500), followed by n distinct positive integers (≤10⁹). These limits are site-added.
输出格式
Output the number of triplets.
样例 1
输入:
5 8
1 2 3 4 5
输出:
4
样例 2
输入:
3 6
1 2 3
输出:
1
样例 3
输入:
4 10
2 5 8 11
输出:
0