AT_arc220_a.Sum of Reciprocals of Squares
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a positive integer N.
Determine whether there exists a sequence of positive integers A=(A1,A2,…,AN) satisfying all of the following conditions, and if so, find one such sequence.
- 1≤Ai≤106
- i=1∑NAi21=1
You are given T test cases; solve each of them.
给定一个正整数 N。
判断是否存在一个由正整数组成的序列 A=(A1,A2,…,AN),满足以下所有条件;若存在,请构造出一个这样的序列。
- 1≤Ai≤106
- i=1∑NAi21=1
你将得到 T 组测试用例,请对每组用例求解。
输入格式
The input is given from Standard Input in the following format:
T
case1
case2
⋮
caseT
Each test case is given in the following format:
N
输入从标准输入给出,格式如下:
T
case1
case2
⋮
caseT
每个测试用例的格式如下:
N
输出格式
Output the answers for the test cases in order, separated by newlines.
For each test case, if no A satisfying all conditions exists, output No.
If an A satisfying all conditions exists, output it in the following format:
Yes
A1 A2 … AN
If multiple A satisfying all conditions exist, any of them will be accepted.
按测试用例的顺序输出答案,每个答案之间用换行符分隔。
对于每个测试用例,若不存在满足所有条件的 A,则输出 No。
若存在满足所有条件的 A,则按以下格式输出:
Yes
A1 A2 … AN
若存在多个满足条件的 A,输出其中任意一个即可。
输入输出样例
输入#1
4 4 2 1 17
输出#1
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
说明/提示
Sample 1 Explanation:
Consider the first test case.
For A=(2,2,2,2), we have i=1∑NAi21=41+41+41+41=1, so we can confirm that the conditions are satisfied.
Constraints
- 1≤T≤500
- 1≤N≤105
- The sum of N over all test cases is at most 105.
- All input values are integers.
样例 1 解释:
考虑第一个测试用例。
对于 A=(2,2,2,2),有 i=1∑NAi21=41+41+41+41=1,因此可以确认条件满足。
限制条件
- 1≤T≤500
- 1≤N≤105
- 所有测试用例的 N 之和不超过 105。
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?