0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

790. 数的三次方根

https://www.acwing.com/problem/content/submission/code_detail/6595736/
This commit is contained in:
Baoshuo Ren 2021-07-22 08:26:45 +08:00 committed by Baoshuo Ren
parent 86a2d782d6
commit 1ac51c9103
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

21
AcWing/790/790.cpp Normal file
View File

@ -0,0 +1,21 @@
#include <bits/stdc++.h>
using namespace std;
double n, l, r;
int main() {
cin >> n;
l = -100.00;
r = 100.00;
while (r - l > 1e-8) {
double mid = (l + r) / 2;
if (mid * mid * mid >= n) {
r = mid;
} else {
l = mid;
}
}
cout << fixed << setprecision(6) << l << endl;
return 0;
}