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(9) << 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 0.01s 5320KB
stdin
20
stdout
10774.958951514
20.155494421 20.695219925 21.233891041 21.771561781 22.308282149 22.844098519 23.379053983 23.913188645 24.446539892 24.979142632 25.511029505 26.042231076 26.572776006 27.102691206 27.632001973 28.160732120 28.688904087 29.216539044 29.743656986 30.270276814 30.796416420 31.322092749 31.847321870 32.372119036 32.896498732 33.420474732 33.944060140 34.467267434 34.990108509 35.512594704 36.034736846 36.556545273 37.078029865 37.599200072 38.120064936 38.640633119 39.160912916 39.680912283 40.200638850 40.720099943 41.239302595 41.758253565 42.276959351 42.795426203 43.313660135 43.831666937 44.349452188 44.867021263 45.384379343 45.901531428 46.418482340 46.935236736 47.451799112 47.968173813 48.484365038 49.000376845 49.516213162 50.031877788 50.547374401 51.062706560 51.577877715 52.092891207 52.607750276 53.122458061 53.637017608 54.151431871 54.665703718 55.179835932 55.693831215 56.207692192 56.721421414 57.235021360 57.748494437 58.261842989 58.775069294 59.288175569 59.801163970 60.314036596 60.826795492 61.339442646 61.851979999 62.364409437 62.876732802 63.388951886 63.901068439 64.413084164 64.925000726 65.436819745 65.948542805 66.460171449 66.971707186 67.483151486 67.994505787 68.505771493 69.016949973 69.528042568 70.039050586 70.549975306 71.060817979 71.571579826 72.082262044 72.592865800 73.103392239 73.613842479 74.124217614 74.634518716 75.144746833 75.654902992 76.164988197 76.675003431 77.184949660 77.694827827 78.204638855 78.714383652 79.224063105 79.733678084 80.243229441 80.752718013 81.262144620 81.771510064 82.280815135 82.790060604 83.299247231 83.808375759 84.317446918 84.826461425 85.335419982 85.844323279 86.353171994 86.861966791 87.370708322 87.879397230 88.388034144 88.896619681 89.405154450 89.913639046 90.422074057 90.930460058 91.438797614 91.947087283 92.455329611 92.963525135 93.471674384 93.979777877 94.487836125 94.995849631 95.503818887 96.011744381 96.519626589 97.027465982 97.535263022 98.043018165 98.550731857 99.058404540 99.566036648 100.073628606 100.581180835 101.088693749 101.596167754 102.103603252 102.611000636 103.118360296 103.625682615 104.132967969 104.640216729 105.147429261 105.654605925 106.161747077 106.668853066