CF1916D.Mathematical Problem

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

The mathematicians of the 31st lyceum were given the following task:

You are given an odd number nn, and you need to find nn different numbers that are squares of integers. But it's not that simple. Each number should have a length of nn (and should not have leading zeros), and the multiset of digits of all the numbers should be the same. For example, for 234\mathtt{234} and 432\mathtt{432}, and 11223\mathtt{11223} and 32211\mathtt{32211}, the multisets of digits are the same, but for 123\mathtt{123} and 112233\mathtt{112233}, they are not.

The mathematicians couldn't solve this problem. Can you?

31 中学的数学家们被布置了如下题目:

给定一个奇数 nn,你需要找出 nn 个互不相同的、均为整数平方的数。但这并不简单:每个数的十进制表示长度必须恰好为 nn(且不能有前导零),并且这 nn 个数的所有数字组成的多重集必须完全相同。例如,234\mathtt{234} 与 432\mathtt{432},以及 11223\mathtt{11223} 与 32211\mathtt{32211} 的数字多重集相同;但 123\mathtt{123} 与 112233\mathtt{112233} 的数字多重集则不同。

这些数学家未能解出该题。你能解决吗?

输入格式

The first line contains an integer tt (1≤t≤1001 \leq t \leq 100) — the number of test cases.

The following tt lines contain one odd integer nn (1≤n≤991 \leq n \leq 99) — the number of numbers to be found and their length.

It is guaranteed that the solution exists within the given constraints.

It is guaranteed that the sum of n2n^2 does not exceed 10510^5.

The numbers can be output in any order.

第一行包含一个整数 tt(1≤t≤1001 \leq t \leq 100)—— 表示测试用例的数量。

接下来的 tt 行,每行包含一个奇数 nn(1≤n≤991 \leq n \leq 99)—— 表示需要找出的数字的个数及其长度。

保证在给定约束下解一定存在。

保证所有 n2n^2 的总和不超过 10510^5。

数字的输出顺序可以任意。

输出格式

For each test case, you need to output nn numbers of length nn — the answer to the problem.

If there are several answers, print any of them.

对于每个测试用例,你需要输出 nn 个长度为 nn 的数字——即该问题的答案。

如果存在多个答案,输出任意一个即可。

输入输出样例

  • 输入#1

    3
    1
    3
    5

    输出#1

    1
    169
    196
    961
    16384
    31684
    36481
    38416
    43681

说明/提示

Below are the squares of the numbers that are the answers for the second test case:

169\mathtt{169} = 132\mathtt{13}^2

196\mathtt{196} = 142\mathtt{14}^2

961\mathtt{961} = 312\mathtt{31}^2

Below are the squares of the numbers that are the answers for the third test case:

16384\mathtt{16384} = 1282\mathtt{128}^2

31684\mathtt{31684} = 1782\mathtt{178}^2

36481\mathtt{36481} = 1912\mathtt{191}^2

38416\mathtt{38416} = 1962\mathtt{196}^2

43681\mathtt{43681} = 2092\mathtt{209}^2

以下是第二组测试用例答案的平方:

169\mathtt{169} = 132\mathtt{13}^2

196\mathtt{196} = 142\mathtt{14}^2

961\mathtt{961} = 312\mathtt{31}^2

以下是第三组测试用例答案的平方:

16384\mathtt{16384} = 1282\mathtt{128}^2

31684\mathtt{31684} = 1782\mathtt{178}^2

36481\mathtt{36481} = 1912\mathtt{191}^2

38416\mathtt{38416} = 1962\mathtt{196}^2

43681\mathtt{43681} = 2092\mathtt{209}^2

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

首页