'commit'
This commit is contained in:
20
LuoGu/RuMen/P2525.cpp
Normal file
20
LuoGu/RuMen/P2525.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user