当前位置 博文首页 > permutation()函数和sort()函数简要笔记_爱新觉罗?炒饭的博客:n
在做题过程中next_permutation()函数一般要搭配sort()函数一起用。
sort(数组名,数组名+数组长度),例如sort(a,a+12),表示升序排序;
next_permutation(数组名,数组名+长度),例如next_permutation(a,a+12);两者搭配一般这样使用:
sort(a,a+数组长度);
do
{
、、、、
}while(next_permutation(a,a+数组长度));
next_permutation参数里的数组一般要求是个升序的排序好的数组!
cs