310974: CF1916A. 2023
Description
In a sequence $a$, whose product was equal to $2023$, $k$ numbers were removed, leaving a sequence $b$ of length $n$. Given the resulting sequence $b$, find any suitable sequence $a$ and output which $k$ elements were removed from it, or state that such a sequence could not have existed.
Notice that you are not guaranteed that such array exists.
InputEach test consists of several test cases. The first line contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases. This is followed by a description of the test cases.
The first line of each test case contains two integers $n$ ($1 \le n, k \le 5$) — the size of sequence $b$ and the number of numbers removed from sequence $a$.
The second line contains $n$ integers $b_1,b_2, \ldots,b_n$ ($1 \leq b_i \leq 2023$) — the remaining sequence. The values of $b_i$ might not be divisors of $2023$.
OutputFor each test case, output "YES" if the sequence $a$ exists, and in the following line output $k$ non-negative integers that were removed from the sequence $a$. If the sequence $a$ does not exist, output "NO" in a single line.
You can output the answer in any case (uppercase or lowercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive answers.
ExampleInput7 2 2 5 2 3 1 7 17 7 4 2 1 289 1 1 3 1 7 17 17 1 1 289 1 1 2023 1 3 1Output
NO NO YES 7 1 YES 1 YES 7 YES 1 YES 7 17 17Note
In third test case product is equal to $289 \cdot 7 = 2023$.
In fourth test case product is already equal to $2023$.
In seventh test case product is equal to $7 \cdot 17 \cdot 17 = 2023$.
Output
给定一个序列b,长度为n,它是从序列a中移除了k个数之后的结果,且序列a的乘积等于2023。需要找到可能的序列a,并输出移除的k个数,或者说明这样的序列a不存在。
输入数据格式:
每个测试包含多个测试用例。第一行包含一个整数t(1≤t≤100)——测试用例的数量。接下来是t个测试用例的描述。
每个测试用例的第一行包含两个整数n(1≤n,k≤5)——序列b的长度和从序列a中移除的数的数量。
第二行包含n个整数b1,b2,…,bn(1≤bi≤2023)——剩余的序列。bi的值可能不是2023的除数。
输出数据格式:
对于每个测试用例,如果存在序列a,则输出"YES",并在下一行输出k个非负整数,表示从序列a中移除的数。如果序列a不存在,则输出"NO"。
输出答案时大小写不敏感,例如"yEs"、"yes"、"Yes"和"YES"都会被识别为肯定的答案。
请注意,题目中提到的序列a乘积等于2023,这意味着序列a中的所有数的乘积必须是2023。题目大意: 给定一个序列b,长度为n,它是从序列a中移除了k个数之后的结果,且序列a的乘积等于2023。需要找到可能的序列a,并输出移除的k个数,或者说明这样的序列a不存在。 输入数据格式: 每个测试包含多个测试用例。第一行包含一个整数t(1≤t≤100)——测试用例的数量。接下来是t个测试用例的描述。 每个测试用例的第一行包含两个整数n(1≤n,k≤5)——序列b的长度和从序列a中移除的数的数量。 第二行包含n个整数b1,b2,…,bn(1≤bi≤2023)——剩余的序列。bi的值可能不是2023的除数。 输出数据格式: 对于每个测试用例,如果存在序列a,则输出"YES",并在下一行输出k个非负整数,表示从序列a中移除的数。如果序列a不存在,则输出"NO"。 输出答案时大小写不敏感,例如"yEs"、"yes"、"Yes"和"YES"都会被识别为肯定的答案。 请注意,题目中提到的序列a乘积等于2023,这意味着序列a中的所有数的乘积必须是2023。