题解 | #数字颠倒#
数字颠倒
http://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
#include<iostream> #include<algorithm> using namespace std; int main() { int n; cin>>n; string s = to_string(n);//将数字转换成字符串; reverse(s.begin(),s.end());//倒序输出 cout<<s<<endl; return 0; }