@Игорь1986
50 / 114 / 29
Регистрация: 08.09.2014
Сообщений: 1,021
|
25.01.2016, 10:40
|
|
C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| #include <iostream>
#include <vector>
#include <algorithm>
int main()
{
std::vector<int> vec;
int n;
std::cin>>n;
for(int i=0; i<n; ++i)
vec.push_back(i+1);
std::cout<<"The "<< n <<"! permutations with "<< n <<" elements\n";
do
{
std::copy(vec.begin(), vec.end(), std::ostream_iterator<int>(std::cout, " "));
std::cout<<'\n';
}while(std::next_permutation(vec.begin(), vec.end()));
return 0;
} |
|
0
|