题解 | #数字颠倒# 对于顺序-‘栈’或者‘队列’
数字颠倒
https://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
#include <iostream> #include <queue> using namespace std; int main() { long input; cin >> input; if(input == 0){ cout << '0' << endl; return 0; } queue<string> st; int tmp = input; while(tmp > 0){ int t = tmp % 10; st.push(to_string(t)); tmp /= 10; } while(!st.empty()){ cout << st.front(); st.pop(); } cout << endl; return 0; } // 64 位输出请用 printf("%lld")