#include using namespace std; #define _p(...) (void)printf(__VA_ARGS__) #define forr(x,arr) for(auto&& x:arr) #define _overload3(_1,_2,_3,name,...) name #define _rep2(i,n) _rep3(i,0,n) #define _rep3(i,a,b) for(int i=int(a);i=int(a);i--) #define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__) #define all(x) (x).begin(), (x).end() #define bit(n) (1LL<<(n)) #define sz(x) ((int)(x).size()) #define fst first #define snd second using ll=long long;using pii=pair; using vb=vector;using vs=vector; using vi=vector;using vvi=vector;using vvvi=vector; using vl=vector;using vvl=vector;using vvvl=vector; using vd=vector;using vvd=vector;using vvvd=vector; using vpii=vector;using vvpii=vector;using vvvpii=vector; templateostream&operator<<(ostream&o,const pair&p){o<<'('< &T, const vector &I, int depth) { //_p("dfs(%d,%d,%f,%f)\n",li,ri,mi,ma); if (li >= ri) return; if (li + 1 == ri) { rep(i, depth, DEPTH) { double mid = (mi + ma) / 2; bool c = calc(mid, a, b) >= T[li]; if (c) ma = mid; else mi = mid; } ans[I[li]] = mi; return; } double mid = (mi + ma) / 2; double val = calc(mid, a, b); if (depth == DEPTH) { rep(i, li, ri) { ans[I[i]] = val; } return; } int th = lower_bound(all(T), val) - T.begin(); //_p("li: %d, ri: %d, th: %d\n", li, ri, th); if (th >= ri) { dfs(li, ri, mi, mid, a, b, T, I, depth + 1); } else if (th <= li) { dfs(li, ri, mid, ma , a, b, T, I, depth + 1); } else { dfs(li, th, mi , mid, a, b, T, I, depth + 1); dfs(th, ri, mid, ma , a, b, T, I, depth + 1); } } void Main() { int T; scanf("%d\n", &T); map>> Q; rep(i, T) { int a, b; double t; scanf("%d%d%lf\n", &a, &b, &t); Q[make_pair(a, b)].emplace_back(t, i); } forr(query, Q) { int a = query.fst.fst; int b = query.fst.snd; if (a == 0 || b == 0) { forr(ti, query.snd) { double t = ti.fst; int idx = ti.snd; if (a == 0) { t = pow(t, 1.0/b); ans[idx] = pow(M_E, t); } else ans[idx] = pow(t, 1.0/a); } continue; } int n = sz(query.snd); sort(all(query.snd)); vd T(n); vi I(n); rep(i, n) { T[i] = query.snd[i].fst; I[i] = query.snd[i].snd; } //cout << "T:"; rep(ii,sz(T)) cout << ' ' << T[ii]; cout << endl; //cout << "I:"; rep(ii,sz(I)) cout << ' ' << I[ii]; cout << endl; double mi = 0; double ma = 10; //[li, ri) int li = 0; int ri = n; dfs(li, ri, mi, ma, a, b, T, I, 0); } rep(i, T) { _p("%.12f\n", ans[i]); } } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); Main(); return 0; }