fork(2) download
  1. #include <iostream>
  2. #include <cmath>
  3. #define PI 3.1415926
  4. using namespace std;
  5.  
  6. double f(double e, double x){
  7. int i = 0;
  8. double p = x;
  9. double s = x;
  10. while (p > e){
  11. p*=(x*x*(2*i + 1)*(2*i + 1))/(2*(i+1)*(2*i + 3));
  12. s+=p;
  13. i++;
  14. }
  15. return s;
  16. }
  17.  
  18. int main() {
  19. double e; //точность
  20. double x;
  21. cin >> e >> x;
  22. cout << PI/2 - f(e, x) << endl;
  23. cout << acos(x);
  24. return 0;
  25. }
Success #stdin #stdout 0s 3460KB
stdin
0.00001 0.99
stdout
0.141873
0.141539