A16414 | 2023
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
Notice that you are not guaranteed that such array exists.
输入格式
Each 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$ .
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$ .
输出格式
For 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.
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.
输入输出样例
输入 #1
7 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 1
输出 #1
NO NO YES 7 1 YES 1 YES 7 YES 1 YES 7 17 17
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$ .
In fourth test case product is already equal to $2023$ .
In seventh test case product is equal to $7 \cdot 17 \cdot 17 = 2023$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted