Advertisement
a53

invers

a53
Dec 8th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4. using namespace std;
  5. long double x,y;
  6.  
  7. void cb(long double st,long double dr)
  8. {
  9. x=(st+dr)/2;
  10. long double f=sin(x)+sin(2*x)+x;
  11. if(abs(f-y)<=0.000000001)
  12. {
  13. cout<<setprecision(8)<<x;
  14. return;
  15. }
  16. if(f<y)
  17. cb(x,dr);
  18. if(f>y)
  19. cb(st,x);
  20. }
  21.  
  22. int main()
  23. {
  24. cin>>y;
  25. cb(0,1);
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement