#include #include #include #include using namespace std; int q; long double x; int main() { cin >> q; for (int i = 0; i < q; i++) { cin >> x; int sz = 10; int lim = x * x / (4 * sz * sz) + 1.01L; for (int j = lim; ; j++) { long double bs = sqrt((long double)(j)); long double rem = sqrt((long double)(j)) * (2 * sz) - x; vector delta(sz); for (int k = 0; k < sz; k++) { int l = 0, r = j; while (r - l > 1) { int m = (l + r) >> 1; if (rem > 2 * bs - sqrt((long double)(j - m)) - sqrt((long double)(j + m))) l = m; else r = m; } rem -= 2 * bs - sqrt((long double)(j - l)) - sqrt((long double)(j + l)); delta[k] = l; } if (rem < 1.0e-10L) { vector ret(2 * sz); for (int k = 0; k < sz; k++) { ret[2 * k] = j - delta[k]; ret[2 * k + 1] = j + delta[k]; } long double val = 0.0; for (int k = 0; k < ret.size(); k++) { val += sqrt(ret[k]); } cerr << fixed << setprecision(15) << j << ' ' << lim << ' ' << val << ' ' << abs(val - x) << endl; cout << ret.size(); for (int k = 0; k < ret.size(); k++) { cout << ' ' << ret[k]; } cout << '\n'; break; } } } return 0; }