fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. vector<int>v={8,6,4,5,2,1};
  7. do{
  8. for(auto i:v)
  9. {
  10. cout<<i<<" "<<endl;
  11. }
  12. }while(next_permutation(v.begin(),v.end()));
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
8 
6 
4 
5 
2 
1 
8 
6 
5 
1 
2 
4 
8 
6 
5 
1 
4 
2 
8 
6 
5 
2 
1 
4 
8 
6 
5 
2 
4 
1 
8 
6 
5 
4 
1 
2 
8 
6 
5 
4 
2 
1