#include #include #include #include #include #include #define repeat(i,n) for (int i = 0; (i) < int(n); ++(i)) #define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i)) #define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) using namespace std; const double eps = 1e-10; double newton(int a, int b, double t, double n) { assert (a >= 1 and b >= 1); auto f = [&](double n) { return pow(n, a) * pow(log(n), b); }; auto f1 = [&](double n) { return a * pow(n, a-1) * pow(log(n), b) + pow(n, a) * b * 1/n * pow(log(n), b-1); }; for (double delta = INFINITY; delta > eps; ) { delta = (f(n) - t) / f1(n); n -= delta; } return n; } int main() { // input int m; scanf("%d", &m); vector as(m), bs(m); vector ts(m); repeat (i,m) scanf("%d%d%lf", &as[i], &bs[i], &ts[i]); // solve array, 10+1>, 10+1> xs = {}; repeat (i,m) xs[as[i]][bs[i]].push_back(i); vector n(m); repeat (a,10+1) { repeat (b,10+1) { if (a == 0) { for (int x : xs[a][b]) { n[x] = exp(pow(ts[x], 1.0/b)); } } else if (b == 0) { for (int x : xs[a][b]) { n[x] = pow(ts[x], 1.0/a); } } else { whole(sort, xs[a][b], [&](int x, int y) { return ts[x] < ts[y]; }); double prev = 22027; // exp(10) repeat_reverse (i, int(xs[a][b].size())) { int x = xs[a][b][i]; double t = ts[x]; prev = n[x] = newton(a, b, t, prev); } } } } // output repeat (i,m) { printf("%.12lf\n", n[i]); } return 0; }