fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <numeric>
  4.  
  5. int f(int x, std::vector<int>& v)
  6. {
  7. return x + v.size();
  8. }
  9. int main()
  10. {
  11. std::vector<std::vector<int>> vv{{1,2,3},{1,1},{4,1,2,3},{9},{1,2,3,4,5,6,7,8,9,0}};
  12. int count = 0;
  13.  
  14. std::cout << std::accumulate(vv.begin(), vv.end(), 0, f) << std::endl;
  15. }
Success #stdin #stdout 0s 3432KB
stdin
Standard input is empty
stdout
20