Time limit 1s, space limit 256MB
Suppose we have a function revNum(num), which can reverse the digits of num. For example, revNum(789) = 987 and revNum(10) = 1.
Now given a list of non-negative integers nums, consider a tuple of indices (i, j, k), where i < j < k, we say the tuple is Good Reverse Tuple if it satisfies nums[i] + nums[j] + nums[k] = revNum(nums[i]) + revNum(nums[j]) + revNum(nums[k]).
Please return the number of Good Reverse Tuple.
The fine line is a number n (3 <= n <= 1000), means the length of the sequence. The second line contains a sequence of n integers. Each integer is in the range [0, 1000].
Print the number of Good Reverse Tuple.
4
21 17 5 23
1
3
3 24 15
0