题解 | #进制转换#
数字颠倒
http://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
C++
很简单的算法
逆序输出
避坑:输入的数字需要转字符串
#include <iostream>
using namespace std;
int main(){
string str;
int num = 0;
while(cin >> num){
str = to_string(num);
int len = str.size();
string res;
for(int i = len-1; i >= 0; i--){
res.push_back(str[i]);
}
cout << res << endl;
}
}
SHEIN希音公司福利 256人发布