平方倒数之和AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)You are given a positive integer $N$.
给定一个正整数 $N$。AI (CI翻译)
Determine whether there exists a sequence of positive integers $A=(A_1,A_2,\ldots,A_N)$ satisfying all of the following conditions, and if so, find one such sequence.
请判断是否存在满足以下所有条件的正整数序列 $A=(A_1,A_2,\ldots,A_N)$;如果存在,请找出任意一个这样的序列。AI (CI翻译)
$1\le A_i\le 10^6$$\displaystyle \sum_{i=1}^N \frac1{A_i^2}=1$
$1\le A_i\le 10^6$$\displaystyle \sum_{i=1}^N \frac1{A_i^2}=1$
You are given $T$ test cases; solve each of them.
给定 $T$ 组测试数据,请分别求解。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1\le T\le 500$$1\le N\le 10^5$- The sum of
$N$over all test cases is at most$10^5$. - All input values are integers.
$1\le T\le 500$$1\le N\le 10^5$- 所有测试数据中的
$N$之和不超过$10^5$。 - 所有输入值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入中按照以下格式给出:AI (CI翻译)
T
\text{case}_1
\text{case}_2
\vdots
\text{case}_T
T
\text{case}_1
\text{case}_2
\vdots
\text{case}_TAI (CI翻译)
Each test case is given in the following format:
每组测试数据的格式如下:AI (CI翻译)
N
NAI (CI翻译)
Output
输出格式
AI (CI翻译)Output the answers for the test cases in order, separated by newlines.
按顺序输出各组测试数据的答案,每组答案之间用换行分隔。AI (CI翻译)
For each test case, if no $A$ satisfying all conditions exists, output No.
对于每组测试数据,如果不存在满足所有条件的 $A$,输出 No。AI (CI翻译)
If an $A$ satisfying all conditions exists, output it in the following format:
如果存在满足所有条件的 $A$,请按照以下格式输出:AI (CI翻译)
Yes
A_1 A_2 \ldots A_N
Yes
A_1 A_2 \ldots A_NAI (CI翻译)
If multiple $A$ satisfying all conditions exist, any of them will be accepted.
如果有多个满足所有条件的 $A$,输出其中任意一个都可以通过评测。AI (CI翻译)
样例
4
4
2
1
17
Yes
2 2 2 2
No
Yes
1
Yes
2 2 3 3 4 4 5 5 6 7 10 14 20 20 21 30 30
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。