要保证a函数为从小到大排序的,所以要用sort
rep(i,1,n) cin>>a[i]; sort(a+1,a+1+n); do{ rep(i,1,n){ cout<<a[i]<<sp; } cout<<endl; }while(next_permutation(a+1,a+1+n));