constint inf = 0x3f3f3f3f; constdouble eps = 1e-4; int n; double a, b;
booljudge(double h){ double cur = h, pre = a; for (int i = 2; i < n; i++) { h = cur; cur = 2 * cur + 2 - pre; if (cur < 0) returnfalse; pre = h; } b = cur; returntrue; } intmain(){ while (~scanf("%d%lf", &n, &a)) { double l = 0, r = a, pre = -inf; while (l < r) { double m = (l + r) / 2; if (judge(m)) { if (fabs(pre - b) < eps) { break; } pre = b; r = m; } else { l = m; } } printf("%.2lf\n", b); } return0; }