← 返回 amazon 的题目列表Count Gift Pairs with Exponential Sum
类型:online_judge
You are given an array where each number represents the price of a gift. If the sum of the prices of two gifts equals 3 raised to some power, then a 50% discount is applied. Return the total number of such pairs that can be found.
Input:
An integer array prices, representing the price of each gift.
Output:
An integer, representing the number of pairs found.
Example:
Input: prices = [1, 2, 3, 9]
Output: 1
Explanation: You can find one pair (1, 2) such that 1 + 2 = 3^1 = 3.
Constraints:
1 <= prices.length <= 10^5
0 <= prices[i] <= 10^9
Example
Input
1 2 3 9