题库练习 Not Dividing
← 上一题 下一题 →

A15687 | Not Dividing

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are given an array of $n$ positive integers $a_1, a_2, \ldots, a_n$ . In one operation, you can choose any number of the array and add $1$ to it.

Make at most $2n$ operations so that the array satisfies the following property: $a_{i+1}$ is not divisible by $a_i$ , for each $i = 1, 2, \ldots, n-1$ .

You do not need to minimize the number of operations.

输入格式

Each test contains multiple test cases. The first line contains the number of test cases $t$ ( $1 \le t \le 10^4$ ). The description of the test cases follows.

The first line of each test case contains an integer $n$ ( $1\le n\le 10^4$ ) — the length of the given array.

The second line of each test case contains $n$ integers $a_1,a_2,\ldots,a_n$ ( $1\le a_i\leq 10^9$ ) — the given array.

It is guaranteed that the sum of $n$ over all test cases does not exceed $5\cdot 10^4$ .

输出格式

For each test case, print the answer on a separate line.

In the only line, print $n$ integers — the resulting array $a$ after applying at most $2n$ operations.

We can show that an answer always exists under the given constraints. If there are multiple answers, print any of them.

输入输出样例

输入 #1
3
4
2 4 3 6
3
1 2 3
2
4 2
输出 #1
4 5 6 7
3 2 3
4 2
C++ 编辑器
输入
输出