#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int n; cin >> n; string s = to_string(n); // C++11 及以上标准中,<string> 头文件提供了一个全局函数 to_string(),可以将各种数值类型转换为 std::string reverse(s.begin(), s.end()); cout << s << endl; } // 64 位输出请用 printf("%lld")