next_permutation就是按照字典序排列得到所有的排列组合! 例如 我们需要输出{ 1 , 2 , 3 , 4 } 的全排列(调用STL) 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 int main() 5 { 6 int ans[4]={1,2,3,4}; 7 sort(ans,ans+4); /* 这个sort可以不用,因为{1,2,3,4}已经排好序*/ 8 do /*注意这步,如果是while循环,则需要提前输出*/ 9 { 10 f...