fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. double f(double x)
  6. {
  7. if ( x < 0.0 ) return cos(4.5 * x * x) + 5.0 * sin(x * x * x - 1.0);
  8. else if ( abs(x) < 1e-9 ) return 7.0;
  9. else return log2(x) + sqrt(x * x + 5.0);
  10. }
  11.  
  12. int main()
  13. {
  14. ifstream cin("math1.inp");
  15. ofstream cout("math1.out");
  16.  
  17. int n;
  18. cin >> n;
  19.  
  20. vector<double> res;
  21.  
  22. double sum = 0.0;
  23. for ( int i = -3; i <= 200; i++ )
  24. {
  25. double x = i / 2.0;
  26.  
  27. double tam = f(x);
  28. if ( tam > n )
  29. {
  30. sum += tam;
  31.  
  32. res.push_back(tam);
  33. }
  34. }
  35.  
  36. sort(res.begin(), res.end());
  37.  
  38. cout << fixed << setprecision(6) << sum << '\n';
  39. for ( double i : res )
  40. cout << i << ' ';
  41.  
  42. cin.close();
  43. cout.close();
  44. return 0;
  45. }
  46.  
Success #stdin #stdout 0s 5320KB
stdin
20
stdout
Standard output is empty