[100 points] [Check whether there is a number combination that meets the conditions]

Title description:

[Check whether there is a number combination that meets the conditions]

Given an array of positive integers, check whether there is a combination of numbers in the array that satisfies the rule:

Rule: A = B + 2C

Enter a description:

The first line outputs the number of elements in the array.

The next line outputs all array elements, separated by spaces.

Output description:

If there is a number that meets the requirements, output the values ​​of A/B/C in the rule in sequence on the same line, separated by spaces.

If not present, output 0.

Example 1 The input and output examples are only for debugging, and the background judgment data generally does not include examples:

enter:

4

2 7 3 0

output:

7 3 2

illustrate:

7 = 3 + 2 * 2

Test site:

  • array traversal
  • computation

code ideas

  1. First, define get_input()the function

Guess you like

Origin blog.csdn.net/weixin_54707168/article/details/131972454