C++ STL next_permutation() prev_permutation(a,a+n)用法。
生活随笔
收集整理的這篇文章主要介紹了
C++ STL next_permutation() prev_permutation(a,a+n)用法。
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
int a[3] = {1,2,3};
a可能形成的集合為{1,2,3},{1,3,2},{2,1,3},{2,3,1},{3,1,2},{3,2,1}。
{2,1,3}的prev是{1,3,2},
next是{2,3,1}。
用法
do{//do something......}while(next_permutation(a,a+n));總結(jié)
以上是生活随笔為你收集整理的C++ STL next_permutation() prev_permutation(a,a+n)用法。的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 51nod 1268 和为K的组合 df
- 下一篇: POJ 3617 Best Cow Li