「algorithm」の編集履歴(バックアップ)一覧はこちら
「algorithm」(2013/11/02 (土) 03:42:52) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
*algorithm
**next_permutation
stringや他のコンテナの全ての順列を生成する。
>||
#include <algorithm>
...
string str = "ABCDEF";
do {
cout << str << endl;
} while(next_permutation(vec.begin(), vec.end()));
Result:
ABCDEF
ABCDFE
ABCEDF
ABCEFD
...
FEDCBA (計 6! = 720個の文字列を生成)
||<
*algorithm
**next_permutation
stringや他のコンテナの全ての順列を生成する。
>||
#include <algorithm>
...
string str = "ABCDEF";
do {
cout << str << endl;
} while(next_permutation(str.begin(), str.end()));
Result:
ABCDEF
ABCDFE
ABCEDF
ABCEFD
...
FEDCBA (計 6! = 720個の文字列を生成)
||<