19 lines
438 B
C++
19 lines
438 B
C++
#include <bits/stdc++.h>
|
||
|
||
using namespace std;
|
||
const double eps = 1e-8;
|
||
int main() {
|
||
double x;
|
||
cin >> x;
|
||
|
||
double l = -10000, r = 10000;
|
||
while (r - l > eps) {
|
||
double mid = (l + r) / 2; // 注意:浮点数这里不能用右移1位!!
|
||
if (mid * mid * mid > x)
|
||
r = mid; // mid>x后面没有"="
|
||
else
|
||
l = mid;
|
||
}
|
||
printf("%.6lf\n", l);
|
||
return 0;
|
||
} |