题目描述
实数二分模板题
C++ 代码
#include<cstdio>
#include<iostream>
using namespace std;
double n;
int main(){
cin >> n;
double l = -10000; double r = 10000;
while(r - l > 1e-8){
double mid = (l+r)/2;
if(mid*mid*mid >= n) r = mid;
else l = mid;
}
printf("%.6lf", l);
return 0;
}