潘CSP100班
1、选出有效排列:根据题目要求,排除无效排列,选出有效排列
2、算法思路:do-while + if (1)用do-while-permutation枚举所有排列 (2)用if判断有效排列
sort(a+0,a+n); //设置当前排列为最小排列 do { for (int i = 0; i< n; i++) { //处理当前排列 if(…){ … } } cout<<endl; } while (next_permutation(a + 0, a + n)); //向后枚举后面的排列