CF1608A.Find Array
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Given n, find any array a1,a2,…,an of integers such that all of the following conditions hold:
-
1≤ai≤109 for every i from 1 to n.
-
a1<a2<…<an
-
For every i from 2 to n, ai isn't divisible by ai−1
It can be shown that such an array always exists under the constraints of the problem.
给定 n,请构造一个由整数构成的数组 a1,a2,…,an,使得以下所有条件均满足:
-
对每个 i(从 1 到 n),均有 1≤ai≤109;
-
a1<a2<…<an;
-
对每个 i(从 2 到 n),ai 不能被 ai−1 整除。
在本题约束下,可以证明这样的数组一定存在。
输入格式
The first line contains the number of test cases t (1≤t≤100). Description of the test cases follows.
The only line of each test case contains a single integer n (1≤n≤1000).
It is guaranteed that the sum of n over all test cases does not exceed 104.
第一行包含测试用例的数量 t(1≤t≤100)。随后是各测试用例的描述。
每个测试用例仅有一行,包含一个整数 n(1≤n≤1000)。
保证所有测试用例中 n 的总和不超过 104。
输出格式
For each test case print n integers a1,a2,…,an — the array you found. If there are multiple arrays satisfying all the conditions, print any of them.
对于每个测试用例,输出 n 个整数 a1,a2,…,an —— 即你找到的数组。如果存在多个满足所有条件的数组,输出其中任意一个即可。
输入输出样例
输入#1
3 1 2 7
输出#1
1 2 3 111 1111 11111 111111 1111111 11111111 111111111
说明/提示
In the first test case, array [1] satisfies all the conditions.
In the second test case, array [2,3] satisfies all the conditions, as 2<3 and 3 is not divisible by 2.
In the third test case, array [111,1111,11111,111111,1111111,11111111,111111111] satisfies all the conditions, as it's increasing and ai isn't divisible by ai−1 for any i from 2 to 7.
在第一个测试用例中,数组 [1] 满足所有条件。
在第二个测试用例中,数组 [2,3] 满足所有条件,因为 2<3 且 3 不能被 2 整除。
在第三个测试用例中,数组 [111,1111,11111,111111,1111111,11111111,111111111] 满足所有条件,因为该数组严格递增,且对任意 i(从 2 到 7),ai 均不能被 ai−1 整除。
输入解题思路,AI测评打分。不知道怎么写?