题解
2024-09-16 11:55:49
发布于:北京
6阅读
1回复
0点赞
c++题解
#include <iostream>
#include <algorithm>
#include <string>
int main() {
int X;
std::cin >> X;
std::string strX = std::to_string(X);
std::next_permutation(strX.begin(), strX.end());
// If the next permutation is still less than or equal to original X
if (strX > std::to_string(X)) {
std::cout << strX << std::endl;
} else {
std::cout << 0 << std::endl;
}
return 0;
}
全部评论 1
人机
2025-01-04 来自 湖南
0
有帮助,赞一个