#include #include #include #include #include #include #include #include #include #include using namespace std; int MOD = 1000000007; const int64_t CYCLES_PER_SEC = 2800000000; const double TIMELIMIT = 8.3; struct Timer { int64_t start; Timer() { reset(); } void reset() { start = getCycle(); } void plus(double a) { start -= (a * CYCLES_PER_SEC); } inline double get() { return (double)(getCycle() - start) / CYCLES_PER_SEC; } inline int64_t getCycle() { uint32_t low, high; __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high)); return ((int64_t)low) | ((int64_t)high << 32); } }; class XorShift { public: unsigned int x, y, z, w; double nL[65536]; XorShift() { init(); } void init() { x = 314159265; y = 358979323; z = 846264338; w = 327950288; double n = 1 / (double)(2 * 65536); for (int i = 0; i < 65536; i++) { nL[i] = log(((double)i / 65536) + n); } } inline unsigned int next() { unsigned int t = x ^ x << 11; x = y; y = z; z = w; return w = w ^ w >> 19 ^ t ^ t >> 8; } inline double nextLog() { return nL[next() & 0xFFFF]; } inline int nextInt(int m) { return (int)(next() % m); } int nextInt(int min, int max) { return min + nextInt(max - min + 1); } inline double nextDouble() { return (double)next() / ((long long)1 << 32); } }; XorShift rnd; #define int long long double calcSum(vector &res) { double r = 0; for (int i = 0; i < res.size(); i++) { r += sqrt(res[i]); } return r; } Timer timer; signed main() { cin.tie(0); ios::sync_with_stdio(false); int Q; cin >> Q; vector res; double sum = 0; double diff; rnd.next(); for (int i = 0; i < Q; i++) { double P; cin >> P; //P = rnd.nextDouble() * 4000 + 8000; res.clear(); int a = (P / 30) * (P / 30); for (int i = 0; i < 30; i++) { res.push_back(a); } int c = 0; //cerr << calcSum(res) << " " << P << endl; double ss; //cerr << res.size() << endl; double tsum; double tss; while (true) { if((c & 0xFFFF) == 0){ sum = calcSum(res); //cerr << sum << " " << P << endl; } int x = rnd.nextInt(30); if (sum < P) { sum -= sqrt(res[x]); res[x] += rnd.nextInt(5) + 1; } else { sum -= sqrt(res[x]); res[x] -= rnd.nextInt(5) + 1; } sum += sqrt(res[x]); if (abs(sum - P) < 1e-5) break; c++; } //cerr << "c=" << c << endl; //cerr <