#include <iostream> using namespace std; int main() { int num; cin >> num; int first_part = num / 1000; // 获取前三位 int second_part = num % 1000; // 获取后三位 if (first_part >= second_part) { cout << num; // 不需要交换 } else { cout << second_part * 1000 + first_part; // 交换并重组 } return 0; } /************************************************************** Problem: 1631 User: linmiaoling Language: C++ Result: Accepted Time:7 ms Memory:2072 kb ****************************************************************/