Processing math: 100%
Triangle edges - MarisaOJ: Marisa Online Judge

Triangle edges

Time limit: 1000 ms
Memory limit: 256 MB
Given an array A of n integers. Count the number of sets (i,j,k) that i<j<k and edges of length Ai,Aj,Ak can form an triangle. For example, you can't form an triangle out of three edges of length 1,2,4. ### Input - The first line contains an integer n. - The second line contains n integer Ai. ### Output - The number of sets (i,j,k) which can form an triangle. ### Constraints - 1≤n≤1500. - 1≤Ai≤109. ### Example Input: 41234 Output: 1