#include using namespace std; const int MAX = 200; int main(){ cout << fixed << setprecision(20); vector> dp(MAX + 1, vector(MAX + 1, 0)); dp[0][0] = 1; for (int i = 0; i < MAX; i++){ for (int j = 1; j <= i; j++){ dp[i + 1][j - 1] += dp[i][j] * j; dp[i + 1][j + 1] += dp[i][j] * j; } for (int j = 0; j <= i; j++){ dp[i + 1][j + 1] -= dp[i][j] * 2 * (i + 1); } } int T; cin >> T; for (int i = 0; i < T; i++){ int N; long double x; cin >> N >> x; long double s = 0; for (int j = N; j >= 0; j--){ s = s * x + dp[N][j]; } s *= pow(x * x + 1, -(long double) N / 2); for (int j = 1; j <= N; j++){ s /= j; } cout << s << endl; } }