IBMOA #2
Triplets
估计中等评测数据准备中,可先阅读题面
Given an array d[n] of distinct integers and an integer threshold t, count the index triplets (a, b, c) satisfying both:
d[a] + d[b] < d[c]d[a] + d[b] + d[c] < t
Example
d = [1, 2, 3, 4, 5], t = 8
Triplets (sorted): (1,2,4) sum=7<8 and 1+2<4 ok; (1,2,3) 1+2<3? no; (1,3,4) 4<4? no.
Answer: 1