//sort
sort(a, a + n);
sort(a, a + n, greater<int>());
sort(a, a + n, cmp);
sort(vec.begin(), vec.end(), [=](pii a, pii b) -> bool {
return a.first < b.first;
}); //匿名函数
//uniquesort(a.begin(), a.end());
a.erase(unique(a.begin(), a.end()), a.end());
//random_sufflerandom_shuffle(a.begin(), a.end());
next_pumutation
string str = "1234";
while (next_permutation(str.begin(), str.end()))
cout << str << endl;
int a[] = { 1,2,3 };
sort(a, a + 3);
do {
cout << a[0] << ' ' << a[1] << ' ' << a[2] << '\n';
}
while (next_permutation(a, a + 3));
string
可以直接 < == > = sortstring s;
cin >> s; // s = “12345”
s += “12345”; // s = “1234512345”
s.erase(5, 3); // s = “1234545”int a = s.find(“45”); // a = 3 kmpint b = s.find(“6”); // b = -1int c = s.length(); // c = 7 size()string t = s.substr(4, 2); // t = “54”