Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- int main() {
- long double x, low, mid, high;
- low = -1;
- high = 5;
- mid = low + (high - low)/2;
- int p = 2000000;
- while(p--) {
- x=mid;
- if((x * x * x) - x - 1 > 0) {
- high = mid;
- mid = low + (high - low)/2;
- }
- else{
- low = mid;
- mid = low + (high - low)/2;
- }
- if(low>high) {
- break;
- }
- }
- cout << fixed << setprecision(70) << x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement