fork download
  1. #include <algorithm>
  2. #include <array>
  3. #include <iostream>
  4. #include <numeric>
  5. using namespace std;
  6.  
  7. #define DENOMINATOR 8820
  8.  
  9. int main() {
  10. array<double, DENOMINATOR> foo;
  11.  
  12. generate(begin(foo), end(foo), [i = double{}]() mutable {
  13. double result = i;
  14. i += 1.0 / DENOMINATOR;
  15. return result;
  16. });
  17.  
  18. cout << *lower_bound(cbegin(foo), cend(foo), 1.0 / 96.0) << endl;
  19. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
0.0104308