CF1828A.Divisible Array

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given a positive integer nn. Please find an array a1,a2,…,ana_1, a_2, \ldots, a_n that is perfect.

A perfect array a1,a2,…,ana_1, a_2, \ldots, a_n satisfies the following criteria:

  • 1≤ai≤10001 \le a_i \le 1000 for all 1≤i≤n1 \le i \le n.
  • aia_i is divisible by ii for all 1≤i≤n1 \le i \le n.
  • a1+a2+…+ana_1 + a_2 + \ldots + a_n is divisible by nn.

给你一个正整数 nn。请构造一个长度为 nn 的完美数组 a1,a2,…,ana_1, a_2, \ldots, a_n。

一个数组 a1,a2,…,ana_1, a_2, \ldots, a_n 被称为完美数组,当且仅当它满足以下条件:

  • 对所有 1≤i≤n1 \le i \le n,有 1≤ai≤10001 \le a_i \le 1000;
  • 对所有 1≤i≤n1 \le i \le n,有 i∣aii \mid a_i(即 aia_i 能被 ii 整除);
  • a1+a2+…+ana_1 + a_2 + \ldots + a_n 能被 nn 整除。

输入格式

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤2001 \le t \le 200). The description of the test cases follows.

The only line of each test case contains a single positive integer nn (1≤n≤2001 \le n \le 200) — the length of the array aa.

每个测试包含多个测试用例。第一行包含测试用例的数量 tt(1≤t≤2001 \le t \le 200)。随后是测试用例的描述。

每个测试用例仅有一行,包含一个正整数 nn(1≤n≤2001 \le n \le 200)——即数组 aa 的长度。

输出格式

For each test case, output an array a1,a2,…,ana_1, a_2, \ldots, a_n that is perfect.

We can show that an answer always exists. If there are multiple solutions, print any.

对于每个测试用例,输出一个完美数组 a1,a2,…,ana_1, a_2, \ldots, a_n。

可以证明答案总是存在。如果存在多个解,输出任意一个即可。

输入输出样例

  • 输入#1

    7
    1
    2
    3
    4
    5
    6
    7

    输出#1

    1
    2 4
    1 2 3
    2 8 6 4
    3 4 9 4 5
    1 10 18 8 5 36
    3 6 21 24 10 6 14

说明/提示

In the third test case:

  • a1=1a_1 = 1 is divisible by 11.
  • a2=2a_2 = 2 is divisible by 22.
  • a3=3a_3 = 3 is divisible by 33.
  • a1+a2+a3=1+2+3=6a_1 + a_2 + a_3 = 1 + 2 + 3 = 6 is divisible by 33.

In the fifth test case:

  • a1=3a_1 = 3 is divisible by 11.
  • a2=4a_2 = 4 is divisible by 22.
  • a3=9a_3 = 9 is divisible by 33.
  • a4=4a_4 = 4 is divisible by 44.
  • a5=5a_5 = 5 is divisible by 55.
  • a1+a2+a3+a4+a5=3+4+9+4+5=25a_1 + a_2 + a_3 + a_4 + a_5 = 3 + 4 + 9 + 4 + 5 = 25 is divisible by 55.

在第三个测试用例中:

  • a1=1a_1 = 1 能被 11 整除。
  • a2=2a_2 = 2 能被 22 整除。
  • a3=3a_3 = 3 能被 33 整除。
  • a1+a2+a3=1+2+3=6a_1 + a_2 + a_3 = 1 + 2 + 3 = 6 能被 33 整除。

在第五个测试用例中:

  • a1=3a_1 = 3 能被 11 整除。
  • a2=4a_2 = 4 能被 22 整除。
  • a3=9a_3 = 9 能被 33 整除。
  • a4=4a_4 = 4 能被 44 整除。
  • a5=5a_5 = 5 能被 55 整除。
  • a1+a2+a3+a4+a5=3+4+9+4+5=25a_1 + a_2 + a_3 + a_4 + a_5 = 3 + 4 + 9 + 4 + 5 = 25 能被 55 整除。

输入解题思路,AI测评打分。不知道怎么写?

首页