fork download
  1. #include <algorithm>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int foo[] = {1, 0, 13};
  8. vector<int> bar(3);
  9.  
  10. generate(bar.begin(), bar.end(), [&]() {
  11. static auto i = 0;
  12. static auto total = 0;
  13.  
  14. total += foo[i];
  15. return foo[i] / total;
  16. });
  17.  
  18. for(auto& i : bar) {
  19. cout << i;
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
100