提交时间:2023-10-30 19:35:04
运行 ID: 108089
#include<cstdio> #include<algorithm> #define rep(a,b,c) for(register int a=b;a<=c;a++) using namespace std; int x[11]; int main() { int n,m=1; scanf("%d",&n); rep(i,1,n) x[i]=i,printf("%d ",i); while(next_permutation(x+1,x+1+n)) { printf("\n");rep(i,1,n) printf("%d ",x[i]); m++; } printf("\n%d",m); }