fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. int main(){
  6.  
  7. std::vector<int> al{ 0, 1, 2, 3, 4, };
  8. std::vector<int> ar{ 5, 6, 7, 8, 9, };
  9. std::vector<std::vector<int>> k(5);
  10.  
  11. for (std::size_t i = 0; i < 5; i++)
  12. {
  13. for (std::size_t j = 0; j < 5; j++)
  14. {
  15. k[j].push_back(al[j]);
  16. k[j].push_back(ar[j]);
  17.  
  18. }
  19. std::rotate(al.begin(), al.begin() + 1, al.end());
  20. std::rotate(ar.rbegin(), ar.rbegin() + 1, ar.rend());
  21. }
  22.  
  23. for (auto& oo : k){
  24. for (auto& o : oo){
  25. std::cout << o;
  26. }
  27. std::cout << std::endl;
  28. }
  29. std::cout << "5Count!!" << std::endl;
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
0519283746
1625394807
2736450918
3847061529
4908172635
5Count!!