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 n, and you need to find n different numbers that are squares of integers. But it's not that simple. Each number should have a length of n (and should not have leading zeros), and the multiset of digits of all the numbers should be the same. For example, for 234 and 432, and 11223 and 32211, the multisets of digits are the same, but for 123 and 112233, they are not.
The mathematicians couldn't solve this problem. Can you?
31 中学的数学家们被布置了如下题目:
给定一个奇数 n,你需要找出 n 个互不相同的、均为整数平方的数。但这并不简单:每个数的十进制表示长度必须恰好为 n(且不能有前导零),并且这 n 个数的所有数字组成的多重集必须完全相同。例如,234 与 432,以及 11223 与 32211 的数字多重集相同;但 123 与 112233 的数字多重集则不同。
这些数学家未能解出该题。你能解决吗?
输入格式
The first line contains an integer t (1≤t≤100) — the number of test cases.
The following t lines contain one odd integer n (1≤n≤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 n2 does not exceed 105.
The numbers can be output in any order.
第一行包含一个整数 t(1≤t≤100)—— 表示测试用例的数量。
接下来的 t 行,每行包含一个奇数 n(1≤n≤99)—— 表示需要找出的数字的个数及其长度。
保证在给定约束下解一定存在。
保证所有 n2 的总和不超过 105。
数字的输出顺序可以任意。
输出格式
For each test case, you need to output n numbers of length n — the answer to the problem.
If there are several answers, print any of them.
对于每个测试用例,你需要输出 n 个长度为 n 的数字——即该问题的答案。
如果存在多个答案,输出任意一个即可。
输入输出样例
输入#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 = 132
196 = 142
961 = 312
Below are the squares of the numbers that are the answers for the third test case:
16384 = 1282
31684 = 1782
36481 = 1912
38416 = 1962
43681 = 2092
以下是第二组测试用例答案的平方:
169 = 132
196 = 142
961 = 312
以下是第三组测试用例答案的平方:
16384 = 1282
31684 = 1782
36481 = 1912
38416 = 1962
43681 = 2092
输入解题思路,AI测评打分。不知道怎么写?