Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
132055 胡海峰老师 04四位数移位 C++ Accepted 2 MS 272 KB 430 2025-10-05 08:57:16

Tests(8/8):


Code:

#include <iostream> #include <iomanip> using namespace std; int main() { int num; cin >> num; int thousand = num / 1000; int hundred = (num / 100) % 10; int ten = (num / 10) % 10; int unit = num % 10; int newNum = unit * 1000 + thousand * 100 + hundred * 10 + ten; // 输出4位数字,不足前面补0 cout << setw(4) << setfill('0') << newNum << endl; return 0; }