Files
python/LuoGu/RuMen/P2525.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

20 lines
486 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
cin >> n;
int a[n];
//输入数据
for (i = 0; i < n; i++)
cin >> a[i];
//而STL中有两个函数分别是 prev_permutation 和 next_permutation.
//它们是现成的求上一个和下一个字典序的序列的。
prev_permutation(a, a + n);//求上一个全排列
//输出
for (i = 0; i < n; i++)
cout << a[i] << " ";
return 0;
}