当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7105:Power Sum

Special Judge 特殊评判
题目描述
Given a positive number $n$, Kris needs to find a positive number $k$ and an array $\{a_i\}(a_i\in\{-1,1\})$ of length $k(1\le k\le n + 2)$, such that:

$$
\sum\limits_{i=1}^k a_i\times i^2 = n
$$

This is too hard for Kris so you have to help him.
输入解释
The input contains multiple test cases.

The first line contains an integer $T(1 \leq T \leq 100)$ indicating the number of test cases.

Each of the next $T$ lines contains one integer $n(1 \leq n \leq 10 ^ 6)$.

It's guaranteed that $\sum{n} \leq 3 * 10 ^ 7$.
输出解释
The output should contain $2T$ lines. For each test case, output two lines.

The first line contains one integer, $k$.

The second line contains a 01-string of length $k$ representing the array, with 0 in the $i$th position denoting $a_i=-1$ and 1 denoting $a_i=1$.

If there are multiple answers, print any.
输入样例
2
1
5
输出样例
1
1
2
11

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7105

最后修改于 2021-10-23T19:11:28+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000/1000MS(Java/Others) 262144/262144K(Java/Others)