本文整理汇总了C++中Permutation::get_string方法的典型用法代码示例。如果您正苦于以下问题:C++ Permutation::get_string方法的具体用法?C++ Permutation::get_string怎么用?C++ Permutation::get_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permutation
的用法示例。
在下文中一共展示了Permutation::get_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(){
vector<vector<unsigned int> > pre_permutation;
// first cycle:
vector<unsigned int> first_cycle;
first_cycle.push_back(1);
first_cycle.push_back(5);
first_cycle.push_back(8);
first_cycle.push_back(6);
first_cycle.push_back(4);
pre_permutation.push_back(first_cycle);
// second cycle:
vector<unsigned int> second_cycle;
second_cycle.push_back(5);
second_cycle.push_back(12);
second_cycle.push_back(9);
second_cycle.push_back(6);
pre_permutation.push_back(second_cycle);
// third cycle:
vector<unsigned int> third_cycle;
third_cycle.push_back(13);
third_cycle.push_back(2);
third_cycle.push_back(12);
third_cycle.push_back(1);
third_cycle.push_back(3);
pre_permutation.push_back(third_cycle);
Permutation P = Permutation(pre_permutation);
cout << "before reducing: " << P.get_string() << endl;
P.reduce();
cout << "after reducing: " << P.get_string() << endl;
// Correct output after reducing:
// (2~12~9~6~4~3~13)(5~8)
Permutation* PP = P*P;
cout << PP->get_string() << endl;
delete PP;
Permutation* P2 = P.power(2);
cout << P2->get_string() << endl;
delete P2;
system("pause");}