Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Mike , intelligent person , challenges his friend suzan with a mathematics task. Whereas, Mike has a list of integers Number N and he has

Mike , intelligent person , challenges his friend suzan with a mathematics task. Whereas, Mike has a list of integers Number N and he has another integer number S . Mike challenges suzan in whether it is possible to obtain the first two numbers in the list, the sum of which is equal to the number S, S = 8 represent the sum of first two number in list , N = 4 is the number of elements in the list . List = 4 5 3 4 , from this ex: first two number = 5 3 .

Input Format

first line there will be an integer number T (number of test cases) followed by 2 input lines for each test case: On the first line of each test case, there will be 2 integers S and N, where S is the expected sum and N is the number of elements in the list. On the second line, there will list of number .

Constraints

1T1000

Output Format

If there is an unique solution: Write two elements, x and y of the list List , such that x+y = S and xy. If there is no solution: Print the error message !NO

Sample Input 0

6 8 4 1 2 4 4 8 4 1 2 7 9 8 4 1 2 8 9 8 4 4 5 3 4 8 4 4 1 1 8 8 4 -1 1 9 8

Sample Output 0

4 4 1 7 !NO 3 5 !NO -1 9

image text in transcribed

Output Format If there is an unique solution: Write two elements, x and y of the list List, such that x+y = 5 and xsy. If there is no solution: Print the error message !NO Sample Input 84 1 2 4 4 1 2 79 1 2 8 9 84 4 5 3 4 84 4 118 8 4 -1 1 98 Sample Output 0 1 7 INO 35 INO -19

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Convert to a rectangular equation. r = 5

Answered: 1 week ago

Question

Prove Equation (5.22).

Answered: 1 week ago

Question

Describe voluntary benefits.

Answered: 1 week ago

Question

Describe the major job evaluation systems.

Answered: 1 week ago