← 返回 meta 的题目列表Find Tuple Pair with Elements Sum Equal to K
类型:online_judge
meta
Given an array of tuples and an integer k, find a pair of tuples such that the sum of all elements in the tuples equals k. The tuple format is (a, b), and you need to find a tuple pair (tuple1, tuple2) such that tuple1[0] + tuple1[1] + tuple2[0] + tuple2[1] = k. Input: an array of tuples and an integer k; Output: a tuple pair that satisfies the condition.
Example
Input
[(1, 2), (3, 4), (5, 6), (7, 8)] 16