A16411 | Mathematical Problem
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $\mathtt{234}$ and $\mathtt{432}$ , and $\mathtt{11223}$ and $\mathtt{32211}$ , the multisets of digits are the same, but for $\mathtt{123}$ and $\mathtt{112233}$ , they are not.
The mathematicians couldn't solve this problem. Can you?
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 $\mathtt{234}$ and $\mathtt{432}$ , and $\mathtt{11223}$ and $\mathtt{32211}$ , the multisets of digits are the same, but for $\mathtt{123}$ and $\mathtt{112233}$ , they are not.
The mathematicians couldn't solve this problem. Can you?
输入格式
The first line contains an integer $t$ ( $1 \leq t \leq 100$ ) — the number of test cases.
The following $t$ lines contain one odd integer $n$ ( $1 \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 $n^2$ does not exceed $10^5$ .
The numbers can be output in any order.
The following $t$ lines contain one odd integer $n$ ( $1 \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 $n^2$ does not exceed $10^5$ .
The numbers can be output in any order.
输出格式
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.
If there are several answers, print any of them.
输入输出样例
输入 #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:
$\mathtt{169}$ = $\mathtt{13}^2$
$\mathtt{196}$ = $\mathtt{14}^2$
$\mathtt{961}$ = $\mathtt{31}^2$
Below are the squares of the numbers that are the answers for the third test case:
$\mathtt{16384}$ = $\mathtt{128}^2$
$\mathtt{31684}$ = $\mathtt{178}^2$
$\mathtt{36481}$ = $\mathtt{191}^2$
$\mathtt{38416}$ = $\mathtt{196}^2$
$\mathtt{43681}$ = $\mathtt{209}^2$
$\mathtt{169}$ = $\mathtt{13}^2$
$\mathtt{196}$ = $\mathtt{14}^2$
$\mathtt{961}$ = $\mathtt{31}^2$
Below are the squares of the numbers that are the answers for the third test case:
$\mathtt{16384}$ = $\mathtt{128}^2$
$\mathtt{31684}$ = $\mathtt{178}^2$
$\mathtt{36481}$ = $\mathtt{191}^2$
$\mathtt{38416}$ = $\mathtt{196}^2$
$\mathtt{43681}$ = $\mathtt{209}^2$
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted