Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- long double x,y;
- void cb(long double st,long double dr)
- {
- x=(st+dr)/2;
- long double f=sin(x)+sin(2*x)+x;
- if(abs(f-y)<=0.000000001)
- {
- cout<<setprecision(8)<<x;
- return;
- }
- if(f<y)
- cb(x,dr);
- if(f>y)
- cb(st,x);
- }
- int main()
- {
- cin>>y;
- cb(0,1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement