#include using namespace std; int a[] = {1, 4, 6, 5, 3, 2, 1}; int main() { next_permutation(a, a + 7); for (int i = 0; i < 7; i++) cout << a[i] << " "; // 答案:1 5 1 2 3 4 6 return 0; }