提交时间:2023-11-04 09:10:05
运行 ID: 108650
#include <iostream> #include <algorithm> using namespace std; int main() { freopen("permutation.in","r",stdin); freopen("permutation.out","w",stdout); int num[9]={1,2,3,4,5,6,7,8,9},n,sum=0; cin>>n; do { for(int i=0;i<n;i++) { cout<<num[i]; } cout<<endl; sum++; }while(next_permutation(num,num+n)); cout<<sum<<endl; return 0; }