#include #include using namespace std;

int main() { int n; cin >> n; int a[n]; for(int i = 0; i < n; i++) { cin >> a[i]; } next_permutation(a, a + n); for(int i = 0; i < n; i++) { cout << a[i] << " "; } cout << endl; return 0; }

输入说明第一行一个整数n。n≤100第二行n个整数每个整数在0到100之间。输出说明n个整数即下一个排列。请用c++写一份程序代码

原文地址: https://www.cveoy.top/t/topic/ewKf 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录